How to disable policy on case by case basis?
Posted: 2018-08-14T07:51:53-07:00
Hi everyone,
Is there a way to disable the "memory" policy for a specific instance of `convert` without affecting other applications using ImageMagick?
More specifically, I have a large amount of PNG image to convert to an animated gif. This is a one-shot operation--and the workstation has more than enough ram to hold the data in main memory. But `convert` insists in "caching" the data beyond the first few MiB to the /tmp directory. Which is useless here.
I assume this was caused by the default policy file (which I don't want to change):
I tried to launch `convert` by changing the MAGICK_MAP_LIMIT, MAGICK_MEMORY_LIMIT and MAGICK_AREA_LIMIT settings in various combination without any success apparently. Same thing using the `-limit memory 1GiB ` command line option.
Is there a way to disable the "memory" policy for a specific instance of `convert` without affecting other applications using ImageMagick?
More specifically, I have a large amount of PNG image to convert to an animated gif. This is a one-shot operation--and the workstation has more than enough ram to hold the data in main memory. But `convert` insists in "caching" the data beyond the first few MiB to the /tmp directory. Which is useless here.
I assume this was caused by the default policy file (which I don't want to change):
Code: Select all
sylvain@bulbizarre:/local/sylvain/d1d2f730467857fa3afe$ cat /etc/ImageMagick-6/policy.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
<!ELEMENT policymap (policy)+>
<!ELEMENT policy (#PCDATA)>
<!ATTLIST policy domain (delegate|coder|filter|path|resource) #IMPLIED>
<!ATTLIST policy name CDATA #IMPLIED>
<!ATTLIST policy rights CDATA #IMPLIED>
<!ATTLIST policy pattern CDATA #IMPLIED>
<!ATTLIST policy value CDATA #IMPLIED>
]>
<policymap>
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<policy domain="resource" name="memory" value="256MiB"/>
<policy domain="resource" name="map" value="512MiB"/>
<policy domain="resource" name="width" value="16KP"/>
<policy domain="resource" name="height" value="16KP"/>
<policy domain="resource" name="area" value="128MB"/>
<policy domain="resource" name="disk" value="1GiB"/>
<!-- <policy domain="resource" name="file" value="768"/> -->
<!-- <policy domain="resource" name="thread" value="4"/> -->
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<!-- <policy domain="resource" name="time" value="3600"/> -->
<!-- <policy domain="system" name="precision" value="6"/> -->
<!-- not needed due to the need to use explicitly by mvg: -->
<!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
<!-- use curl -->
<policy domain="delegate" rights="none" pattern="URL" />
<policy domain="delegate" rights="none" pattern="HTTPS" />
<policy domain="delegate" rights="none" pattern="HTTP" />
<!-- in order to avoid to get image with password text -->
<!--<policy domain="path" rights="none" pattern="@*"/>-->
<policy domain="path" rights="read" pattern="@/tmp/*"/>
<policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>
</policymap>
I tried to launch `convert` by changing the MAGICK_MAP_LIMIT, MAGICK_MEMORY_LIMIT and MAGICK_AREA_LIMIT settings in various combination without any success apparently. Same thing using the `-limit memory 1GiB ` command line option.