Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

ImageMagick operation not authorized

📅 2020-Jun-20 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ imagemagick ⬩ 📚 Archive


I tried to convert a few PNG files to a PDF file using the convert tool that ships with ImageMagick as described here.

With ImageMagick 6.9.7, I got this error message:

$ convert *.png out.pdf
convert-im6.q16: not authorized `out.pdf' @ error/constitute.c/WriteImage/1037.

With ImageMagick 6.9.10, I got this error message:

$ convert *.png out.pdf
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408.


Since ImageMagick is sometimes used on web servers to operate on images for users, it has security checks on certain operations. The above error was caused since my operation failed one of its policies.

Since I am doing these operations locally, I do not really want ImageMagick imposing security policies. So I moved its policy file so that it is not used:

$ sudo mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xml.orig

My conversion worked after this change.

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧