Page 1 of 1
How to get uncompressed size or Bits-per-Pixel
Posted: 2008-08-13T09:38:28-07:00
by codymanix
I want to display to the user the uncompressed size of an Image. If there isn't such a method, is there any way to get the bits-per-pixel of an Image?
There is a method GetDepth() but then I do need to know how many components make up a pixel, also, the depth may not be equal in all components?
So I basically want for example that a pixelformat like "R5 G6 B5" returns me "16" and so on.
Re: How to get uncompressed size or Bits-per-Pixel
Posted: 2009-07-25T16:24:55-07:00
by codymanix
Nobody knows an answer? If it is currently not possible with IM could we expect this feature in one of the future versions?
Re: How to get uncompressed size or Bits-per-Pixel
Posted: 2012-12-10T14:22:10-07:00
by hreinn1000
Did you ever get an answer to this ? Seems like this should be a core function, must be calculated each time the image info is accessed...
Re: How to get uncompressed size or Bits-per-Pixel
Posted: 2013-04-16T18:52:01-07:00
by anthony
uncompressed size is generally a multiply of width*height*bits_per_pixel plus the meta data.
the problem is it is format dependant. some formats include large volumes of meta data (a bit like microsoft word doc format) others like PbmPlus (NetPBM) has only a few bytes of meta-data. And then some formats have no uncompressed form as it really completely changes how the image data is stored (Jpeg for example).
basically it is format dependant, and IM does not have any way of knowing how big a specific format (compressed or uncompressed) will be. It can make some guesses as to a minimum uncomressed size (without meta-data) but that is simply a multiply, and depends again on the bits_per_pixel whcih is again format dependant.
So in summery. No, a MagickCore function can not, in general, tell you even a uncompressed image file size. If it did it is only a guess.