osfar
osfar

Reputation: 413

What is the size of indexed image of 512*512 with 256 color values?

If I have an image of resolutin of 512 * 512,
and this image is indexed with 256 color values,
how to calulate the size of the image (file size ) ?

Upvotes: 2

Views: 16499

Answers (1)

tomahh
tomahh

Reputation: 13661

The image itself can be calculate as follow

256 can be stored in one byte. So one pixel is 1 byte.

You have a 512*512 pixels.

512*512*1 = 262144 But on your disk, it will take a little more than those 262ko, as you have to count the bytes used for the file meta-information, and the color palette.

Check out the bmp header spec if you need more informations.

Upvotes: 2

Related Questions