#1 2022-02-12 04:33:19

Mark O'Shea

ImageMagick is unable regenerate multisize images for very large JPEGs


I'm having problems with ImageMagick generating multiple size images for four very large JPEG files.

When I use batch manager and attempt to generate multiple size images for these very large files I get this error:

16 photos can not be regenerated.

Piwigo also fails to generate the images automatically when browsing the gallery.

My gallery has no problem generating multiple size images for standard JPEGs and also works fine when I active the GD graphics library instead of ImageMagick.

Here's a small list of what works and what doesn't work with some recent test images that I uploaded:

28949 x 3466  15.11 MB = unable to generate
29999 x 2993  7.47 MB = unable to generate
33021 x 2832  15.01 MB = unable to generate
28890 x 4079  16.63 MB = unable to generate

10482 x 2423  3.47 MB = successful
10183 x 1313  2.50 MB = successful
10675 x 4509  1.97 MB = successful
7009 x 3316 4.58 MB = successful

My gallery has 28,203 images and none apart from the four files listed above are affected by this.

It looks to me as if ImageMagick is hitting some sort of file size or memory limit and just giving up or being blocked.

My default settings for, "/etc/ImageMagick-6/policy.xml", are:

  <policy domain="resource" name="memory" value="256MiB"/>
  <policy domain="resource" name="map" value="512MiB"/>
  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>
  <policy domain="resource" name="area" value="128MB"/>
  <policy domain="resource" name="disk" value="1GiB"/>

I have tried increasing all the above values but that did not make any difference at all.

I can't find any log files to give further information about the cause of the error. There is nothing mentioned in the PHP logs or the Piwigo logs, which I activated with: "$conf['enable_i_log'] = true;"

Do you have any idea how I can get rid of this issue?

Thanks Mark

Here are details of my gallery:

There are four multiple size images set up:

Square 120 x 120 pixels, crop
Thumbnail 396 x 198 pixels
M - medium 792 x 594 pixels
L - large 1008 x 756 pixels
Image quality: 95%


Piwigo 12.2.0
Operating system: Linux
PHP: 7.3.31-1~deb10u1 (Show info) [2022-02-12 02:55:12]
MySQL: 5.5.5-10.3.31-MariaDB-0+deb10u1 [2022-02-12 02:55:12]
Graphics Library: ImageMagick 6.9.10-23
Cache size 12576.55 Mo   calculated 1 day ago Refresh

Activated plugin list: 16

Additional Pages
Admin Tools
Advanced Menu Manager
Batch Downloader
Charlie's content 3.2.4
Crypto Captcha
Extended Description
Grum Plugins Classes.3
Language Switch
LocalFiles Editor
Take A Tour of Your Piwigo

Real memory: 337.98 MiB used, 340.36 MiB cached, 1.94 GiB total
Virtual memory: 272 MiB used, 1.99 GiB total
Local disk space: 214.76 GiB used, 243.1 GiB total



#2 2022-02-12 12:10:20

Only trying to help

Re: ImageMagick is unable regenerate multisize images for very large JPEGs

Try what ImageMagick's convert on the command line gives. I'd assume that the available memory for images of that size (100 megapixels) simply is not sufficient.

Running Piwigo at



#3 2022-02-13 15:34:47

Mark O'Shea

Re: ImageMagick is unable regenerate multisize images for very large JPEGs

Thanks for the suggestion.

I ran this command:
convert /var/www/gallery/galleries/Test/PrimroseHill.jpg  -resize 396x198 test.jpg

And I got this error:
convert-im6.q16: width or height exceeds limit `/var/www/gallery/galleries/Test/PrimroseHill.jpg' @ error/cache.c/OpenPixelCache/3912.
convert-im6.q16: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3258.

So I changed a setting here:

I increased the width and height by adding a zero:
  <policy domain="resource" name="width" value="160KP"/>
  <policy domain="resource" name="height" value="160KP"/>

When I ran the above command again, it worked! So then I went back to Piwigo and tried again but I still got the same error:
4 photos can not be regenerated

I also went through the different sizes, one by one, and I also restarted Apache but I still got the same error in Piwigo.



Board footer

Powered by FluxBB

github twitter newsletter Donate © 2002-2022 · Contact