Page 1 of 1
Monochrome Memory Reduction?
Posted: 2010-02-21T18:07:00-07:00
by anotherprogrammer123
Hello,
I was wondering if ImageMagick uses more memory than needed for pixels.
If I load an image that has 256^2 colors, ImageMagick will use 2 bytes per pixel, right?
But, if I load an image that only has 2 colors, will ImageMagick use 1 bit per pixel for memory or 1 byte per pixel?
I am concerned about efficiency.
Thanks in advance!
Re: Monochrome Memory Reduction?
Posted: 2010-02-21T18:25:07-07:00
by magick
Re: Monochrome Memory Reduction?
Posted: 2010-02-23T17:01:57-07:00
by anotherprogrammer123
Thanks, I read through that page and what I picked up is that Imagemagick does not use less memory for monochrome images. It must hold a minimum of 4 unsigned bytes per pixel.
Is this true?
Thanks,
Sorry for the late response.
Re: Monochrome Memory Reduction?
Posted: 2010-02-24T05:32:47-07:00
by snibgo
Yes.
Re: Monochrome Memory Reduction?
Posted: 2010-02-24T11:15:51-07:00
by anotherprogrammer123

that's too bad...
Re: Monochrome Memory Reduction?
Posted: 2010-02-24T13:11:46-07:00
by anotherprogrammer123
Are you sure? I can't believe that ImageMagick would have such a design.
What if I am working with .gif images of 9 million pixels with only 2^8 = 256 colors? Normally I would only need 1 byte per pixel in this case, but ImageMagick requires 4 bytes (= 4 times as much memory)?
Re: Monochrome Memory Reduction?
Posted: 2010-02-24T13:36:37-07:00
by magick
Read
http://www.imagemagick.org/script/archi ... p#overview. It explains why we took the design approach we did with the pixel cache. If memory is an issue, use -limit area 0 to force the pixels to disk. If that solution is not acceptable there are plenty of alternative image processing utilities that have a smaller memory footprint than ImageMagick.
Re: Monochrome Memory Reduction?
Posted: 2010-02-24T14:13:38-07:00
by anotherprogrammer123
Okay. It was done for efficiency and generability.
Thanks for clarifying this.