Click here to Skip to main content
15,879,184 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Whats the size of each pixel of a bitmap in memory?
Posted
Updated 4-Dec-09 5:30am
v2

I suppose it depends on color depth... [rolleyes]
See BITMAP struct definition [^], the bmBitsPixel member looks promising.
:)

 
Share this answer
 
In the most of the cases, if you're running more than 256 colors, it will be 32 bits (one processor word, even if the color itself is represented by 3 bytes of the four).
Otherwise, for 256 colors, 1 byte;
and for 16 colors 1 bit of four different bytes (one per color plane, also named RGBI)
 
Share this answer
 
The other thing to remember is that 24 bit images are word aligned, so there can be some padding at the end of each row. This means that the size is not per pixel at all. Perhaps if you told us what you're doing, we could be more precise in our replies.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900