I want to read the RGB values for each pixel from a .bmp
file, so I can convert the bmp
into a format suitable for GBA (GameBoy Advance).
I
If the BMP file has a palette then the below code should work:
FILE *inFile, *outFile;
inFile = fopen("C:/in.bmp", "rb");
Rgb Palette[256];
if ( inFile ) {
// Bypass headers
fseek(inFile, sizeof(BmpHeader) + sizeof(BmpImageInfo), SEEK_SET);
// Load the whole palette
fread(Palette, sizeof(Palette), 1, inFile);
fclose(inFile);
}