September 12, 2018
ImageMagick has a security policy file policy.xml using which we can control and limit the execution of the program. For example, the default memory limit of ImageMagick-6 is 256 MiB.
Recently, we saw following error while processing a gif image.
convert-im6.q16: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert-im6.q16: cache resources exhausted `file.gif' @ error/cache.c/OpenPixelCache/3945.
This happens when ImageMagick cannot allocate enough memory to process the
image. This can be fixed by tweaking memory configuration in policy.xml
.
Path of policy.xml
can be located as follows.
$ identify -list policy
Path: /etc/ImageMagick-6/policy.xml
Policy: Resource
name: disk
value: 1GiB
Memory limit can be configured in the following line of policy.xml
.
<policy domain="resource" name="memory" value="256MiB"/>
Increasing this value would solve the error if you have a machine with larger a memory.
If this blog was helpful, check out our full blog archive.