Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving colors in binary files

Status
Not open for further replies.

katenka5

ISP
Nov 30, 2001
15
US
How do you save a color in a binary file?
Do you assing special values to R, G and B, or you can actually save a hexadecimal color value as string and then use it, if so, then how do you convert it back?
 
Colors are broken down into the Red, Green, and Blue components. In 24 bit color, each byte represents the intensity of that color. The first byte represents the red intensity (0-255), the second is for green, and the third is blue.

In 16 bit color, two bytes are used, with 5 bits use for each color, which give you 32 intensity levels (0-31) for each color.

How you choose to store this information is really entirely up to you, provide that your input and output routines perform the necessary conversions, if any.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I don't see a problem with just saving the colour as a long value...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top