The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

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.

Comments

2 responses to “Imagemagick 6 vs. PDF”

  1. scruss2 Avatar

    Or use img2pdf – https://gitlab.mister-muffin.de/josch/img2pdfalmost 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

    1. Ed Avatar

      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.