Blog

ImageMagick Cache Resources Exhausted

Imagemagick-logo
Linux

ImageMagick Cache Resources Exhausted

With file sizes as they are these days, you might get an error while trying to convert files with ImageMagick. The error message might read: “cache resources exhausted”.

To allow ImageMagick to use more cache, if you have it available, follow these steps:

Open a terminal, enter this command and run it by hitting enter:

sudo gedit /etc/ImageMagick-6/policy.xml

Look for the following line in the file:

<policy domain=”resource” name=”disk” value=”1GiB”/>

If the file has been edited before or the default changed, then the value “1GiB” might be different. Regardless, here we will assign a larger value for the resources.

Change the line to the following to allow for 8GB of resources. You could change this to whatever you like, as long as the format is correct. If you want a refresher on the decimal or binary units for bytes, they’re ordered in a simple to understand table at the Wikipedia page on the byte: https://en.wikipedia.org/wiki/Byte#Multiple-byte_units

Change from:

<policy domain=”resource” name=”disk” value=”1GiB”/>

to:

<policy domain=”resource” name=”disk” value=”8GB”/>

Save the file and exit the editor.

ImageMagick may now use eight times the resources it previously had. If you need more or less resources to get the conversion done, simply change policy.xml file to your liking. Make sure not to exceed your hardware’s specifications because the entire system could freeze up on you.

User Agreement

Welcome to Modern Samurai.

An important part of establishing a contract is meeting of the minds. Where many websites hide their user agreement (a.k.a. terms of use, terms of service) at the bottom of their pages, we prefer to be upfront and honest about what you’re getting into. Please download our User Agreement and review it. If you agree, click “Agree” to continue to this Site. If you do not agree, click “Decline” to move away from this Site.