If I defined a struct like this:
struct rgb
{
double r;
double g;
double b;
};
And each element is a percentage.
How to get these values from a .bmp file in C or C++?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The wikipedia entry for BMP files has a nice description of the file format. At the bottom of that page there is a link to this file bitmap.h which I’ve used before to read BMP files.
Basically, once you’ve read your BMP file, you should just divide each Red, Green and Blue value in the RGBA structs by 255 to get a percentage.