Using the MagickWand API I'm attempting to calculate the decompressed size of an image defined by:
height * width * bits per pixel
I can query the height and width straightforwardly, but I'm not sure about bits per pixel.
MagickGetImageDepth() looked like a reasonable candidate but reading the code it seems to visit every pixel in the image, whereas I'd have expected the number of channels & channel sizes to be defined by the format (i.e. known independently of the image data), so I'm not sure this is what I want.
Scanning down the API I can't see any other likely candidate functions.
Can anyone point me at the function I need?
Calculating image size (bytes)
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Calculating image size (bytes)
Also multiply by the number of channels EG RGB and optional A (matte) channels. The depth per color value is fixed at compile time as the 'Q' level for IM.
will let you see the compiled 'Q' level.
Code: Select all
identify -version
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/