Skip to content

Image(i,j)->Red is not working #2

@Nomad-Learner

Description

@Nomad-Learner

I saw the page https://bytes.com/topic/c/answers/580148-bitmap-hexadecimal-conversion

It told me that if I use

cout << "red: " << Image(i,j)->Red << "\t"
<< "green: " << Image(i,j)->Green << "\t"
<< "blue: " << Image(i,j)->Blue << endl;

   this code, I will get R/G/B value of bmp file

but it is not work.

this is my code.
when I use Image(i,j), It works
but when I use Image(i,j)->Red it is not work

#include "EasyBMP.h"
#include
using namespace std;

int main()
{
ofstream fout;
fout.open("long.hex");
BMP Image;

Image.ReadFromFile("test_red.bmp");

for (int j = 0; j < Image.TellHeight(); j++)
{
	for (int i = 0; i < Image.TellWidth(); i++)
	{
		fout << hex << Image(i, j) << endl;
	}
	cout << endl;
}

//for (int j = 0; j < Image.TellHeight(); j++)
//{
//	for (int i = 0; i < Image.TellWidth(); i++)
//	{
//		cout << Image(i, j)->Red << "\t"
//			<< Image(i, j)->Green << "\t"
//			<< Image(i, j)->Blue << endl;
//	}
//	
//}

return 0;

}

this is what happen.
ques

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions