ImageMagick Cache Resources Exhausted
1 April 2022 2023-07-15 15:29ImageMagick 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.