Pages

Showing posts with label convert files. Show all posts
Showing posts with label convert files. Show all posts

ImageMagic convert error: convert:not authorized `***` @ error/constitute.c/ReadImage/


Recently I got an error while converting from .tiff to .eps (Ubuntu 16.04 machine). This error happened for other file formats also. 


convert:not authorized `fileName.tif` @ error/constitute.c/ReadImage/***
convert:not authorized `fileName.pdf` @ error/constitute.c/ReadImage/***
convert:not authorized `fileName.png` @ error/constitute.c/ReadImage/***

A quick googling gave follwing solution.

Go to /etc/ImageMagic-c/

In this directory, edit the file policy.xml by using

sudo vi policy.xml

and edit the following lines.


<policy domain="coder" rights="none" pattern="PS" />
<policy domain="coder" rights="read|write" pattern="EPS" />
<policy domain="coder" rights="read|write" pattern="PDF" />
<policy domain="coder" rights="read|write" pattern="TIF" />
<policy domain="coder" rights="none" pattern="XPS" />


Note that I wanted to convert TIF file. So I added the line
<policy domain="coder" rights="read|write" pattern="TIF" />

So, by adding "read|write" in the rights option, it the ImageMagic convert will work now.

But, after doing your job, it is better to change to rights="none" because of the security issue (which the actual reason for disabling)


Converting files ( to .eps or pdf) format

For scientific publications, figures are often asked in .eps format.

To do this (from formats like .tif/.jpg/.png), in linux, the package "convert" can be used.

Try this for a file name Figure1.tif

convert Figure1.tif Figure1.eps

This will produce a Figure1.eps file in the current directory.


Some times, you may want to convert a text file (like code) which is written using vim/emacs editor.

This can be done using LibreOffice (a open source) application.

In terminal, 

libreoffice --convert-to "pdf" fileName.txt
The output will be filename.pdf 
Or, open the file in LibreOffice and save as pdf.


If all these doesn't work, some times, I use following online site to convert to eps.

https://image.online-convert.com/convert-to-eps

In this site, you can specify dpi and many attributes of the output file.







You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...