ImageMagick: "not authorized" error when creating PDF
Posted: Wed Mar 31, 2021 1:41 pm
[PROBLEM]
I've been using the following ImageMagick command to convert a series of images (jpg, png, etc) into a nice PDF for a few years without any issues:
Since a recent update of ImageMagick, the command throws the following error:
[SOLUTION]
It seems that due to a security issue in Ghostscript, ImageMagick disabled PDF generation temporarily by default until that issue is fixed.
Here's a workaround:
In /etc/ImageMagick-6/policy.xml, search for the following rule:
And either comment it (using HTML comments) or change "rights" to "read|write":
Worked in my case B)
Xubuntu 18.04
ImageMagick 6.9.7-4 Q16 x86_64 20170114
GhostScript 9.26~dfsg+0-0ubuntu0.18.04.14
Thanks to thread "ImageMagick not authorized to convert PDF to an image" (on Stackoverflow).
Additional links:
ArchLinux bug tracker: FS#60580 - imagemagick 7.0.8.14-1 does not work with PDF's
I've been using the following ImageMagick command to convert a series of images (jpg, png, etc) into a nice PDF for a few years without any issues:
Code: Select all
$ convert $SOURCE -resize 1800x1800 -compress jpeg -density 150 -units PixelsPerInch -quality 76% $TARGET
convert-im6.q16: not authorized `test.pdf' @ error/constitute.c/WriteImage/1037.
[SOLUTION]
It seems that due to a security issue in Ghostscript, ImageMagick disabled PDF generation temporarily by default until that issue is fixed.
Here's a workaround:
In /etc/ImageMagick-6/policy.xml, search for the following rule:
Code: Select all
<policy domain="coder" rights="none" pattern="PDF" />
Code: Select all
<policy domain="coder" rights="read|write" pattern="PDF" />
Xubuntu 18.04
ImageMagick 6.9.7-4 Q16 x86_64 20170114
GhostScript 9.26~dfsg+0-0ubuntu0.18.04.14
Thanks to thread "ImageMagick not authorized to convert PDF to an image" (on Stackoverflow).
Additional links:
ArchLinux bug tracker: FS#60580 - imagemagick 7.0.8.14-1 does not work with PDF's