Imagemagick: Mogrify and Convert both throw "not authorized" error

Created on 14 Sep 2018  路  8Comments  路  Source: ImageMagick/ImageMagick

Description

Currently, attempting to use mogrify -format pdf ~/Desktop/TIFFs/*.tif results in the following error message:

mogrify: not authorized `PDF' @ error/constitute.c/IsCoderAuthorized/408.

Steps to Reproduce

brew install ImageMagick
mogrify -format pdf ~/Desktop/TIFFs/*.tif
Error -> mogrify: not authorized `PDF' @ error/constitute.c/IsCoderAuthorized/408.

System Configuration

  • ImageMagick version: ImageMagick 7.0.8-11_1 (Most recent for what Homebrew retrieves)
  • Environment (Operating system, version and so on): MacOS X High Sierra, Version 10.13.6
  • Additional information: MacBook Pro 13" laptop
upstream

Most helpful comment

In my case, the problem was solved following these indications:
https://nowardev.wordpress.com/2018/11/04/convert-im6-q16-not-authorized-kubuntu-pdf-imagemagick-convert-shit-error/

Edit the file /etc/ImageMagick-6/policy.xml to have that values:
<policy domain="coder" rights="read|write" pattern="PDF" />

All 8 comments

With ImageMagick 7, you need to put magick before mogrify and all other tools except convert. magick simply replaces convert. Do not use magick convert. You also need Ghostscript and Tiff delegates. This works for me on IM 7.0.8.11 Q16 MacOSX Sierra with Ghostscript 9.24 and TIFF 4.0.9_0.

convert logo: logo.tiff
magick mogrify -format pdf logo.tiff

However, when I try to display the PDF in PREVIEW, it says the file could not be opened. However, ImageMagick works as

display logo.pdf

I can also open it in GraphicConverter and Photoshop.

magick mogrify -format pdf ~/Desktop/TIFFs/testDoc.tif returns the same message:
mogrify: not authorized `PDF' @ error/constitute.c/IsCoderAuthorized/408

Am I missing a prerequisite? I've removed convert from the script I'm using and now rely on mogrify, but still need to get it working. I currently have libtiff 1.0.9 and Ghostscript 9.25

It looks like the Homebrew team disabled PDF by default:

You will need to patch your policy.xml file.

Found the issue. Apparently as of ImageMagick 7, the policy.xml file negates all permissions of the program in order to protect security. Line 80 and line 87 of /usr/local/etc/ImageMagick-7/policy.xml must have rights="none" changed to rights="all" or a similar permission node.

Edit @dlemstra beat me to it. Thanks for the info.

For anyone coming across this, the change in Homebrew has since been reverted https://github.com/Homebrew/homebrew-core/pull/32150

I ran into this on Arch Linux - their upgrades broke my code calling image_write from the R magick package. I'll go post a note on the Arch page.

In my case, the problem was solved following these indications:
https://nowardev.wordpress.com/2018/11/04/convert-im6-q16-not-authorized-kubuntu-pdf-imagemagick-convert-shit-error/

Edit the file /etc/ImageMagick-6/policy.xml to have that values:
<policy domain="coder" rights="read|write" pattern="PDF" />

Was this page helpful?
0 / 5 - 0 ratings