ImageMagick ‘convert’ command for PDF, PS, PS2/PS3, EPS files do NOT work out-of-the-box in Ubuntu 22.04, Linux Mint 21 & Debian 11. Here’s how to fix the issue!
It seems to be policy issue, the PDF, PS, PS2/PS3, EPS file formats support are disabled in the ImageMagick in Debian based systems. When you trying to run convert
command for one of the images mentioned above, it outputs something like:
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF’ @ error/constitute.c/IsCoderAuthorized/421
And, graphical applications (such as Converseen) based on ImageMagick will output an empty file. To fix the issue, follow the steps below one by one.
Fix ‘attempt to perform an operation not allowed by the security policy’
1. Firstly, search for and open a terminal window from system application launcher or ‘Activities’ overview.
2. When terminal opens, run command to edit the ImageMagick policy file:
sudo gedit /etc/ImageMagick-*/policy.xml
NOTE: replace gedit in command with gnome-text-editor for Ubuntu 22.10 +. Or, use nano instead that works in most Linux.
3. When the file opens in text editor, scroll down and find out the following lines:
<policy domain="coder" rights="none" pattern="PS" /> <policy domain="coder" rights="none" pattern="PS2" /> <policy domain="coder" rights="none" pattern="PS3" /> <policy domain="coder" rights="none" pattern="EPS" /> <policy domain="coder" rights="none" pattern="PDF" /> <policy domain="coder" rights="none" pattern="XPS" />
To re-enable one of these file formats support! Either DELETE the relevant line, or change rights=”none” to rights=”read | write”.
Finally, save the file and enjoy! For nano
command line text editor, press Ctrl+X, then type y and hit Enter to save file.
Leave a Reply