Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

ImageMagick operation not authorized

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

Problem

I tried to convert a few PNG files to a PDF file using ImageMagick's covert tool as described here. That threw up this error:

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

Solution

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.

Tried with: ImageMagick 6.9.7 and Ubuntu 18.04