Pages

Showing posts with label imageMagic. Show all posts
Showing posts with label imageMagic. Show all 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 default, the ImageMagic conversion is turned-off for some image file extensions. For example, I frequently convert .jpeg/.jpg to .eps. But, every time, I got an error. Here is the way how to solve it [Remember to change back the settings after converting the file in order to avoid vulnerability].

You have to change the policy.xml file in the installed ImageMagic package. 

To do that, USE:

sudo vim /etc/ImageMagick-6/policy.xml

and change the following line

<policy domain="coder" rights="none" pattern="EPS" />

to 

<policy domain="coder" rights="read | write" pattern="EPS" />

and save. Note that you should change "none" to "read | write" and then save.

Once you did this modification, you can convert using "convert" command.

Now, TRY:

convert figure.jpg figure.eps

After conversion, you may change back the line as it was before (to avoid vulnerability) which is very important.

For more information on the security issues, you can visit these links.

https://www.enisa.europa.eu/publications/info-notes/what2019s-behind-imagemagick-vulnerability

https://security.stackexchange.com/questions/122328/how-to-prevent-the-latest-imagemagick-vulnerability

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)


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...