I'm using Imagemagick on a rails app with Minimagick and I generate some pictogram with it.
When I launch my process I have this error and I don't find a solution:
MiniMagick::Error (`convert -limit memory 2GiB -limit map 2GiB -limit disk 4GiB -background none -fill #000000 -font ttf/SELIS006N.ttf -pointsize 300 label: S public/pictogram_images/RECINTAN-EL-064-layer-1.png` failed with error:
convert.im6: cache resources exhausted ` S' @ error/cache.c/OpenPixelCache/4078.
convert.im6: no images defined `public/pictogram_images/RECINTAN-EL-064-layer-1.png' @ error/convert.c/ConvertImageCommand/3044.
):
My process is simple, I have some .tff file and each character is a pictogram. I just want to generate all preview of this character in png.
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 day
sed -i -E 's/name="memory" value=".+"/name="memory" value="8GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="map" value=".+"/name="map" value="8GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="area" value=".+"/name="area" value="8GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="disk" value=".+"/name="disk" value="8GiB"/g' /etc/ImageMagick-6/policy.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With