6

This seems to be related to my previous question where there was a ghostscript bug and thus ImageMagick devs made a security policy blocking PDF conversion. This was overcome by adjusting the policy file such that rights changed from "none" (by default) to "read | write"

My similar problem is initiated when running a command of the form

convert input.pdf output.jpg

Now with ghostscript version 9.27 (2019-04-04) and imagemagick version 7.0.8-56 Q16 x86_64 (2019-07-21) (I believe this is the newest version of each), I get this error

convert: attempt to perform an operation not allowed by the security policy `gs' @ error/delegate.c/ExternalDelegateCommand/378.
convert: no images defined `output.jpg' @ error/convert.c/ConvertImageCommand/3273.

So I have sudoedited /etc/ImageMagick-7/policy.xml such that the only uncommented lines in the <policymap> are changed from

<policy domain="delegate" rights="none" pattern="gs" />

to

<policy domain="coder" rights="read | write" pattern="PDF" />
<policy domain="delegate" rights="read | write" pattern="gs" />

but the problem persists. Equivalent results if simply commenting out or deleting the above line. This is reproducible on more than one of my Arch machines.

Is there a way to bypass this security policy default? Is it safe to do so?

KenS
  • 27,930
  • 2
  • 31
  • 42
T. Zack Crawford
  • 3,812
  • 2
  • 8
  • 11
  • See https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 – fmw42 Jul 25 '19 at 21:16

2 Answers2

7
<policy domain="delegate" rights="none" pattern="gs" />

needs to be commented out. This is now noted on the imagemagick page of the arch wiki. That page currently cites these bug reports: FS#59778, FS#62171

For some reason, this didn't immediately work for me. Somehow I got it to work today by moving policy.xml to a backup (deleting), running the convert command, and moving back the original with the line above commented out.

T. Zack Crawford
  • 3,812
  • 2
  • 8
  • 11
  • You also have to change rights="none" to read|write. See my link in my comment below the original post. – fmw42 Aug 08 '19 at 23:36
  • I just tried with current arch linux and this does not fix the issue (for me). I am still getting "convert: attempt to perform an operation not allowed by the security policy `gs'..." Any current documentation on how to setup convert & ImageMagick & gs correctly on arch / manjaro? – moin moin Sep 10 '20 at 08:11
0

I was having only one of these problems: convert: no images defined 'output.jpg' @ error/convert.c/ConvertImageCommand/3273.

On my system, this fixed it: brew install ghostscript. (via How do I install imagemagick with homebrew?)

I'm using ImageMagick on OSX, installed via homebrew.

Will Hanley
  • 327
  • 1
  • 12