Setting PerlMagic resource limits...

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
User avatar
magick
Site Admin
Posts: 11209
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

ImageMagick unpacks images into separate red, green, blue, and opacity components at the depth its was built at. So even though your image is 1 bits-per-pixel, for the Q8 version it is expanded to 32 bits-per-pixel. If your image has a colormap, it requires 40 bits-per-pixel. For a 20,000 by 15,000 image that means the pixel cache requires about 1.3GB of storage. It would be easy to argue that it is quite inefficient to store 1- bit monochrome images into a 32-bit pixel but when we designed ImageMagick it was the only reasonable solution we could come up with that could handle hundreds of different image formats with tens of different image depths with many different storage formats (e.g. monochrome, colormapped, RGB, RGBA, CMYK, CMYKA, and others) and about a thousand different image-processing algorithms.

User avatar
magick
Site Admin
Posts: 11209
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

If the ImageMagick resource limits permit it, ImageMagick will attempt to allocate the pixel cache in memory. However, if the malloc() call fails, it writes the pixel cache to disk instead. In your case, it appears that the malloc() is failing to return the requested 1.3GB memory allocation.

User avatar
magick
Site Admin
Posts: 11209
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

ImageMagick reports resources with three numbers. The first is the current resource request, the second is the total resources consumed at the moment, and the last is the resource limit. In the case of the pixel cache, when the memory limit is reached, the next image is automatically cached to memory-mapped disk unless that limit is exceeded. If so, the pixels are cached to disk. If the disk limit is exceeded, ImageMagick refuses to creates the image.

Post Reply