cache resources exhausted Imagemagick cache resources exhausted Imagemagick linux linux

cache resources exhausted Imagemagick


Find the policy.xml with find / -name "policy.xml"

something like /etc/ImageMagick-6/policy.xml

and change <policy domain="resource" name="disk" value="1GiB"/> to <policy domain="resource" name="disk" value="8GiB"/>

refer to convert fails due to resource limits

Memory issues


The error probably occurs because you run out of memory. You can check for the resources using the following command:

convert -list resource

The output will be somewhat like this:

Resource limits:  Width: 16KP     Height: 16KP     Area: 128MP     Memory: 256MiB     Map: 512MiB     Disk: 1GiB     File: 768     Thread: 8     Throttle: 0     Time: unlimited

Here, you can see that the assigned amounts of disk space and memory are very small. So, in order to modify it you need to change the policy.xml file located somewhere in /etc/ImageMagick-6 directory.
Change <policy domain="resource" name="disk" value="1GiB"/> to <policy domain="resource" name="disk" value="4GiB"/> in the policy.xml file.


sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml //this one is just to solve convertion from .tiff to pdf, you may need it some daysed -i -E 's/name="memory" value=".+"/name="memory" value="8GiB"/g' /etc/ImageMagick-6/policy.xmlsed -i -E 's/name="map" value=".+"/name="map" value="8GiB"/g' /etc/ImageMagick-6/policy.xmlsed -i -E 's/name="area" value=".+"/name="area" value="8GiB"/g' /etc/ImageMagick-6/policy.xmlsed -i -E 's/name="disk" value=".+"/name="disk" value="8GiB"/g' /etc/ImageMagick-6/policy.xml