0

I need help to calculate compression of a PNG file in Windows 10 64-bit operating system. Formula is raw data size = image width * image heigth * (bits per pixel / 8).

Comment from the author of above formulas is sometimes 24 bit images are actually stored as 32 bit value. Is this file actually stored as 32 or 64 bit value ?

enter image description here VBA Object property does not explicity show decompressed size, compression level, encoding method, bit-per-channel, how it is pasted

REFERENCE:

Estimating compression ratio of any image file is actually pretty simple. You have to know the width, height and bit depth of the image. To calculate how much data would be needed by uncompressed raw image data you have to do this simple thing: raw data size = image width * image heigth * (bits per pixel / 8). Then just divide raw data size by your PNG's file size by and you have the estimated compression ratio (not exact value because of the headers, etc.). For example, 640x480x32 image would need 640 * 480 * (32 / 8) which is 1 273 800 bytes. Now let's assume your PNG has 200kB. You divide (200 * 1024) / 1273800. That gives you a compression ratio of about 0.16.

How to know the compression level of a PNG file and whether it is lossy? - Super User

1 Answers1

3

The fact that an image is sometimes "32-bit" has nothing to do with the CPU or OS architecture (or whatever right term should be conned the "32-bit or 64-bit" refers to).

The most usual case for it to be "32-bit" is because there are four instead of three 8-bit channel, and the extra channel (in addition to RGB) would be A (for Alpha, i.e., the transparency channel).

As someone noted in a comment, PNG is (losslessly) compressed so you don't get the actual file size with the formula you mentioned. However, bit-per-channel still makes sense in it as that how much it would takes up after decompression.

Tom Yan
  • 10,996