Hace tiempo trabajé con BMP's hice un programita que transformaba bitmaps a escala de grices... quizá esto te de una idea: 
//TRANSFORMA A GRISES ARCHIVOS BMP 
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#define MAX_NOMARCH 256 
int main (int argc, char *argv[]) 
{ 
   FILE *fpin; 
   char *nome, str[MAX_NOMARCH + 1], id[] = "  "; 
   long int despl, ancho, alto, bxp; 
   if (argc > 1) 
      nome = argv[1]; 
   else { 
      printf ("Archivo BMP que se va a transformar: "); 
      fgets (str, MAX_NOMARCH, stdin); 
      nome = str; 
   } 
   if ((fpin = fopen (nome,"rb")) == NULL) { 
      fprintf (stderr, "Error al abrir el archivo %s\n", nome); 
      exit (EXIT_FAILURE); 
   } 
   printf ("Datos de la imagen:\n"); 
   fread (id, 2, 1, fpin); 
   printf ("\tIdentificador de bitmap: %s\n", id); 
   fseek (fpin, 10L, SEEK_SET); 
   fread (&despl, sizeof (long), 1, fpin); 
   printf ("\tDesplazamiento a los datos: %ld\n", despl); 
   fseek (fpin, 18L, SEEK_SET); 
   fread (&ancho, sizeof (long), 1, fpin); 
   fread (&alto, sizeof (long), 1, fpin); 
   printf ("\tDimensiones de la imagen, ancho: %ld, alto: %ld\n", ancho, alto); 
   fseek (fpin, 28L, SEEK_SET); 
   fread (&bxp, sizeof (long), 1, fpin); 
   printf ("\tBits por pixel: %ld\n", bxp); 
   if (strcmp (id, "BM")) 
   { fprintf (stderr, "La imagen debe ser un bitmap.\n"); }
   //CAMBIO A GRIS PARA IMAGENES DE 8 BITS
   if(bxp==8)
   {
    int i;
    FILE *fpout;
    fseek (fpin, 0L, SEEK_SET);
    fpout = fopen ("Igris.bmp", "wb");
    for (i=0; i < despl; i++)
    fputc (fgetc (fpin), fpout);
    for (i=0; i < ancho * alto; i++) {
    int j,gris;
    char r, g, b, q;
    fread (&b, sizeof (0.25), 1, fpin);
    fread (&g, sizeof (0.25), 1, fpin);
    fread (&r, sizeof (0.25), 1, fpin);
    read(fpin,&q,(0.25)); 
    gris=(0.299*r)+(0.587*g)+(0.144*

;
         for (j = 0; j < 3; j++)
        fwrite (&gris, sizeof (0.25), 1, fpout);
    }
  fclose (fpout);
  printf ("\n\tArchivo en escala de grises ----> Igris.bmp\n");
 }   
// CAMBIO A GRIS PARA ARCHIVOS DE 1,4 Y 24 BITS. 
   else if(bxp!=8)  { 
      int i; 
      FILE *fpout; 
      fseek (fpin, 0L, SEEK_SET); 
      fpout = fopen ("Igris.bmp", "wb"); 
      for (i=0; i < despl; i++) 
         fputc (fgetc (fpin), fpout); 
      for (i=0; i < ancho * alto; i++) { 
         int j,gris; 
         char r, g, b; 
         fread (&r, sizeof (char), 1, fpin); 
         fread (&g, sizeof (char), 1, fpin); 
         fread (&b, sizeof (char), 1, fpin); 
         gris=(0.299*r)+(0.587*g)+(0.144*

;
    for (j = 0; j < 3; j++) 
             fwrite (&gris, sizeof (char), 1, fpout); 
      } 
      fclose (fpout); 
      printf ("\n\tArchivo en escala de grises ----> Igris.bmp\n"); 
   } 
   fclose (fpin); 
Espero te sirva de algo , la lógica es similar para lo que buscas hacer... es cuestión de hacer sólo unas pequeñas modificaciones =)..