Imagemagick 6 vs. PDF

Come to find out Xubuntu 18.04 ratcheted the ImageMagick security settings up to a dangerous chattering whine:

convert p???.jpg "Machining D-bit Drills.pdf"
convert-im6.q16: not authorized `Machining D-bit Drills.pdf' @ error/constitute.c/WriteImage/1037.

Fortunately, someone who understands this stuff encountered the problem before I did and posted a great description of the solution.

To forestall link rot, the process looks like:

cd /etc/ImageMagick-6/
sudo cp policy.xml policy.xml.base
sudo nano policy.xml
… change one line …
 policy domain="coder" rights="read|write" pattern="PDF"

It is completely unclear to me whether ImageMagick (as of ImageMagick 6.9.7-4 Q16 x86_64 20170114 ) requires or merely tolerates the vertical bar in place of commas, nor whether it’s in my best interest to replace "coder" with "*".

In any event, I can once again stuff bitmap images into PDF files.


  1. #1 by scruss2 on 2018-12-03 - 18:58

    Or use img2pdf – always results in smaller files and makes it easy to add PDF metadata. It’s a great way of archiving JPEGs, as all the metadata are retained and the original files can be extracted using pdfimages

    • #2 by Ed on 2018-12-03 - 20:18

      So many utilities, all doing much the same thing, only differently!

      Thanks for the suggestion: when this happens again, I’ll (try to) learn something new again.