Skip to content

Instantly share code, notes, and snippets.

@DSchougaard
Created September 24, 2011 15:16
Show Gist options
  • Save DSchougaard/1239441 to your computer and use it in GitHub Desktop.
Save DSchougaard/1239441 to your computer and use it in GitHub Desktop.
for( y = 0; y < correctedWidth; y++){
for( x = 0; x < image->Height; x++){
if( y < image->Width){
fread(&pixel.red, sizeof(pixel.red), 1, fp);
fread(&pixel.green, sizeof(pixel.green), 1, fp);
fread(&pixel.blue, sizeof(pixel.blue), 1, fp);
tempVal = 0.3*pixel.red+0.59*pixel.green+0.11*pixel.blue;
image->Pixels[x+y*correctedWidth] = (BYTE)tempVal;
}else{
fgetpos (fp, &position);
position++;
fsetpos(fp, &position);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment