Page 1 of 1

Imagemagick not using enough memory

Posted: 2012-05-21T15:48:37-07:00
by thelizardreborn
I've found lots of posts about limiting Imagemagick's memory consumption. My problem is the opposite - our server is processing a large batch of images, and it appears as though "convert" is using no memory, and the excess of disk usage is causing the server to grind to a halt.

Relevant information
My command:

Code: Select all

nice convert -limit map 512mb -limit memory 512mb  -size 1000x1000 -quality 85 -flatten -scale 1000x1000 '/opt/lightbox/appfiles/thumbs/thm9c0qIj/fullkhzbBJ.jpg[1000x1000]'  '/opt/lightbox/appfiles/thumbs/thm9c0qIj/usrqGlJJI.jpg'
ImageMagick info:

Code: Select all

convert -version
Version: ImageMagick 6.7.6-9 2012-05-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:
top output:

Code: Select all

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2223 apache    39  15 36208 2988 2180 R 97.0  0.0   0:03.11 convert
This is running on CentOS Linux, being run by PHP through the command line.

There are no active policies in policy.xml.

To be clear, I have looked at the documentation I could find about -limit, and I think the setting we have is good. I would like convert to use up to 512mb of memory, but for some reason it seems to be behaving as though the memory limit is 0.

Re: Imagemagick not using enough memory

Posted: 2012-05-21T15:56:16-07:00
by magick
For large images, ImageMagick will likely create a pixel cache on disk. To verify, add -debug cache to your command line. It tells you how much resource is required for a particular image and whether the resource is allocated to memory, memory-map, or disk. See http://www.imagemagick.org/script/architecture.php for additional details.