Error “convert: cache resources exhausted” (SOLVED)

When using the convert utility to convert images, you may encounter an error stating that the cache resources have been exhausted.

Command example:

convert -density 300 -quality 100 input.pdf output.png

An example of the error it causes:

convert-im6.q16: cache resources exhausted `/tmp/magick-q7O_IcbbGpFULs5R34rLlwAyeW1slGHi19' @ error/cache.c/OpenPixelCache/4095.

This error occurs when two conditions are combined:

  • processing a large file (for example, when converting PDF to JPG)
  • weak computer with little RAM

As a quick fix, you can try reducing the image quality:

convert -density 150 -quality 70 input.pdf output.png

The -density option specifies the horizontal and vertical density of the image, that is, the number of dots. Typically, for scanning photographs, the setting is set to 300 dots – this is enough for good image quality for viewing on a monitor screen and for printing. You can experiment by choosing a lower value.

The -quality option specifies the compression level for JPEG/MIFF/PNG. Option value 100 means no compression, 100% image quality. An option value of 70 means 70% of the image quality by reducing its size.

If you do not want to reduce the quality, then you can try changing the settings. To do this, open the policy.xml file. Depending on your Linux distribution and version of ImageMagick, the path to the file may vary, for example:

  • /etc/ImageMagick-6/policy.xml
  • /etc/ImageMagick-7/policy.xml

Find and edit the string value:

<policy domain="resource" name="memory" value="256MiB"/>

4 observations on “Error “convert: cache resources exhausted” (SOLVED)
  1. Joe

    Thank you for this tip. It's a good idea in this day and age where every PC has many GB of RAM and cameras are writing larger and larger files to increase this value.
    Increasing this value to 1024 GiB is a practical value.


    I resolved this error by changing the file at: #/etc/imagemagick-6/policy.xml
    I reset all "policy … resource" lines with larger values.


Leave Your Observation

Your email address will not be published. Required fields are marked *