Change policy via command argument or environment variable

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
darkdragon-001
Posts: 1
Joined: 2018-10-12T10:44:55-07:00
Authentication code: 1152

Change policy via command argument or environment variable

Post by darkdragon-001 »

Ubuntu 18.04's version ships with a policy file which includes the following:

Code: Select all

<policy pattern="PDF" domain="coder" rights="none"></policy>
My program wants to use ImageMagick's identify command with PDF files.

How can I overwrite this policy without urging the user to manually change it?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Change policy via command argument or environment variable

Post by snibgo »

You can't. The file sets limits that can't be overridden. Change the file if you need to.
snibgo's IM pages: im.snibgo.com
rolffagerberg
Posts: 1
Joined: 2018-10-15T17:31:38-07:00
Authentication code: 1152

Re: Change policy via command argument or environment variable

Post by rolffagerberg »

I have the same recently arisen problem with convert (version ,6.8.9-9). I do not have root priviliges on my Ubuntu system (it is a department wide system run by admins), hence I cannot change the file /etc/ImageMagick-6/policy.xml. I tried to make a changed local copy of policy.xml and setting $MAGICK_CONFIGURE_PATH to the current dir ".", but the system file seems to be loaded last (as "convert -list policy" shows), hence overwriting my changed permissions. It seems really strange that I suddenly cannot invoke convert anymore for my pdf to png conversion (without asking the admins to change the global policies). Is there no way around that?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Change policy via command argument or environment variable

Post by fmw42 »

The policy for PDF was recently added due to recently uncovered security issue with the processing of PDF by Ghostscript. Though I hear that the Ghostscript issue may have been fixed subsequently. So you likely need to bring that to the attention of your hosting provider and see if they will edit the policy.xml file to allow the reading of PDF files.
Post Reply