Ok so I am having trouble editing a bitmap image file. I have successfully copied the header of the bitmap from one file to the other, but now I want to copy the pixel data also. However I want to invert the colours of the image as I do this, therefore i want to have 255-value for each pixel.
So basically what I want is a loop that reads in one byte at a time, somehow does 255-x, be it through converting to decimal or bits etc. Then write it to the new file.
I had tried using a for loop like this but it did not work.
P.s. The array size is down to the image being 64x64 and 3 bytes for each pixel (RGB)
fread(fileheader, 1, 52, fileA);
fwrite(bmaptype, 1, 2, fileB);
fwrite(fileheader, 52, 1, fileB);
for (i=0; i<12287; i++)
fread(pixel[i], 1, 1, fileA);
fwrite(pixnew[i], 1, 1, fileB);
Any help would be greatly appreciated. Thank you.