PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
3 posts • Page 1 of 1
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.
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.