I even tried that stack overflow - every attempt gives the same 20 pages and cache error
my file
sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-7/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-7/policy.xml
sed -i -E 's/name="map" value=".+"/name="map" value="8GiB"/g' /etc/ImageMagick-7/policy.xml
sed -i -E 's/name="area" value=".+"/name="area" value="8GiB"/g' /etc/ImageMagick-7/policy.xml
sed -i -E 's/name="disk" value=".+"/name="disk" value="8GiB"/g' /etc/ImageMagick-7/policy.xml
That is what the cache resource ImageMagick stackoverflow.com post said was a fix. I did that as well. I saved the original copy of policy.xml as policy.ori so I could undo every change if I needed to.
No matter what values I put in, the selection with 68 images it cache errors after 20 pages. The weird part is if I tried one with 168 images, it makes it to 108 pages before the cache error. Every image is about a 2MB image.
Why did the ImageMagick-5 have no issues with the default values and ImageMagick-7 fail no matter what is in the policy.xml.
# diff -Naur /etc/ImageMagick-7/policy.xml /etc/ImageMagick-7/policy.ori
--- /etc/ImageMagick-7/policy.xml 2025-08-14 07:00:49.127284223 -0500
+++ /etc/ImageMagick-7/policy.ori 2025-07-16 04:49:34.000000000 -0500
@@ -48,18 +48,18 @@
<!-- Set maximum amount of memory in bytes to allocate for the pixel cache
from the heap. When this limit is exceeded, the image pixels are cached
to memory-mapped disk. -->
- <policy domain="resource" name="memory" value="8GiB"/>
+ <policy domain="resource" name="memory" value="256MiB"/>
<!-- Set maximum amount of memory map in bytes to allocate for the pixel
cache. When this limit is exceeded, the image pixels are cached to
disk. -->
- <policy domain="resource" name="map" value="8GiB"/>
+ <policy domain="resource" name="map" value="512MiB"/>
<!-- Set the maximum width * height of an image that can reside in the pixel
cache memory. Images that exceed the area limit are cached to disk. -->
- <policy domain="resource" name="area" value="8GiB"/>
+ <policy domain="resource" name="area" value="16KP"/>
<!-- Set maximum amount of disk space in bytes permitted for use by the pixel
cache. When this limit is exceeded, the pixel cache is not be created
and an exception is thrown. -->
- <policy domain="resource" name="disk" value="8GiB"/>
+ <policy domain="resource" name="disk" value="1GiB"/>
<!-- Set the maximum length of an image sequence. When this limit is
exceeded, an exception is thrown. -->
<policy domain="resource" name="list-length" value="128"/>
#
I got it to work also with these values - threads seem to be ignored as I set it to 8 and got 1
> convert -list resourceResource limits:
Width: 12000P
Height: 12000P
Area: 15.0324GP
List length: 512B
Memory: 14GiB
Map: 14GiB
Disk: 14GiB
File: 768
Thread: 1
Throttle: 0
Time: 4 minutes
>
# diff -Naur /etc/ImageMagick-7/policy.xml /etc/ImageMagick-7/policy.ori
--- /etc/ImageMagick-7/policy.xml 2025-08-14 12:22:57.162429225 -0500
+++ /etc/ImageMagick-7/policy.ori 2025-07-16 04:49:34.000000000 -0500
@@ -37,10 +37,10 @@
-->
<policymap>
<!-- Set maximum parallel threads. -->
- <policy domain="resource" name="thread" value="8"/>
+ <policy domain="resource" name="thread" value="2"/>
<!-- Set maximum time in seconds. When this limit is exceeded, an exception
is thrown and processing stops. -->
- <policy domain="resource" name="time" value="240"/>
+ <policy domain="resource" name="time" value="120"/>
<!-- Set maximum number of open pixel cache files. When this limit is
exceeded, any subsequent pixels cached to disk are closed and reopened
on demand. -->
@@ -48,27 +48,27 @@
<!-- Set maximum amount of memory in bytes to allocate for the pixel cache
from the heap. When this limit is exceeded, the image pixels are cached
to memory-mapped disk. -->
- <policy domain="resource" name="memory" value="14GiB"/>
+ <policy domain="resource" name="memory" value="256MiB"/>
<!-- Set maximum amount of memory map in bytes to allocate for the pixel
cache. When this limit is exceeded, the image pixels are cached to
disk. -->
- <policy domain="resource" name="map" value="14GiB"/>
+ <policy domain="resource" name="map" value="512MiB"/>
<!-- Set the maximum width * height of an image that can reside in the pixel
cache memory. Images that exceed the area limit are cached to disk. -->
- <policy domain="resource" name="area" value="14GiB"/>
+ <policy domain="resource" name="area" value="16KP"/>
<!-- Set maximum amount of disk space in bytes permitted for use by the pixel
cache. When this limit is exceeded, the pixel cache is not be created
and an exception is thrown. -->
- <policy domain="resource" name="disk" value="14GiB"/>
+ <policy domain="resource" name="disk" value="1GiB"/>
<!-- Set the maximum length of an image sequence. When this limit is
exceeded, an exception is thrown. -->
- <policy domain="resource" name="list-length" value="512"/>
+ <policy domain="resource" name="list-length" value="128"/>
<!-- Set the maximum width of an image. When this limit is exceeded, an
exception is thrown. -->
- <policy domain="resource" name="width" value="12KP"/>
+ <policy domain="resource" name="width" value="8KP"/>
<!-- Set the maximum height of an image. When this limit is exceeded, an
exception is thrown. -->
- <policy domain="resource" name="height" value="12KP"/>
+ <policy domain="resource" name="height" value="8KP"/>
<!-- Periodically yield the CPU for at least the time specified in
milliseconds. -->
<!-- <policy domain="resource" name="throttle" value="2"/> -->
#