Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. BMP Reader C Code

BMP Reader C Code

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structureshelp
14 Posts 6 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mitesh Karwa
    wrote on last edited by
    #1

    I was developing a simple program to read an 24-bit BMP image, convert it into 8-bit intensity map and then display it as a grayscale image. Please review this code and tell me where I am getting an error...

    #include<stdio.h>
    #include<conio.h>
    #pragma pack(2)

    typedef struct
    {
    unsigned short int type;
    unsigned int size;
    unsigned short int reserved1,reserved2;
    unsigned int offset;
    }HEADER;

    typedef struct
    {
    unsigned int size;
    int width,height;
    unsigned short int bits;
    unsigned int compression;
    unsigned int imagesize;
    int xresolution,yresolution;
    unsigned int ncolors;
    unsigned int impcolors;
    }INFOHEADER;

    typedef struct
    {
    unsigned int R,G,B;
    }PIXEL;

    void main()
    {
    HEADER headfirst;
    INFOHEADER headsecond;
    PIXEL pix;
    FILE *fin,*fout,*f1;
    char *read;
    int ch=0,i,j,mat[768],R[256],G[256],B[256],Gray[256];
    float Y[256];

      //Read Image Header
      fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
      if(fin==NULL)
      {
                   printf("Error");
                   exit(0);
      }
      fread(&headfirst,sizeof(headfirst),1,fin);
      if(headfirst.type!=19778)
      {
                               printf("Not BMP");
                               getch();
                               return(0);
                               }
      printf("Header %x ",headfirst.type);
      printf("%u ",headfirst.size);
      printf("%u %u ",headfirst.reserved1,headfirst.reserved2);
      printf("%u\\n",headfirst.offset); 
      fin=fopen("C:/Dev-Cpp/1.bmp","rb+");         
      fread(&headsecond,sizeof(headsecond),1,fin);
    
      //Read Image Information Directory
      printf("IFD %u",headsecond.size);
      printf("%d %d %u %u %u %d %d %u %u\\n",headsecond.width,headsecond.height,headsecond.height,headsecond.bits,headsecond.compression,headsecond.imagesize,headsecond.xresolution,headsecond.yresolution,headsecond.ncolors,headsecond.impcolors);
      
      //Read Image Pixel Values
      fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
      if(fin==0)
      {return(0);
      }
      for(i=0;i<headfirst.offset;i++)
      {
                                     ch=getc(fin);//Remove Offset
      }
      i=0;
      while ((ch=fgetc(fin))!=EOF)
      {
           mat\[i\]=(int)ch;
           i++;
      }
     //mat\[\] gives me the whole array of pixels in the image
     //Now I need to co
    
    CPalliniC H K B X 5 Replies Last reply
    0
    • M Mitesh Karwa

      I was developing a simple program to read an 24-bit BMP image, convert it into 8-bit intensity map and then display it as a grayscale image. Please review this code and tell me where I am getting an error...

      #include<stdio.h>
      #include<conio.h>
      #pragma pack(2)

      typedef struct
      {
      unsigned short int type;
      unsigned int size;
      unsigned short int reserved1,reserved2;
      unsigned int offset;
      }HEADER;

      typedef struct
      {
      unsigned int size;
      int width,height;
      unsigned short int bits;
      unsigned int compression;
      unsigned int imagesize;
      int xresolution,yresolution;
      unsigned int ncolors;
      unsigned int impcolors;
      }INFOHEADER;

      typedef struct
      {
      unsigned int R,G,B;
      }PIXEL;

      void main()
      {
      HEADER headfirst;
      INFOHEADER headsecond;
      PIXEL pix;
      FILE *fin,*fout,*f1;
      char *read;
      int ch=0,i,j,mat[768],R[256],G[256],B[256],Gray[256];
      float Y[256];

        //Read Image Header
        fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
        if(fin==NULL)
        {
                     printf("Error");
                     exit(0);
        }
        fread(&headfirst,sizeof(headfirst),1,fin);
        if(headfirst.type!=19778)
        {
                                 printf("Not BMP");
                                 getch();
                                 return(0);
                                 }
        printf("Header %x ",headfirst.type);
        printf("%u ",headfirst.size);
        printf("%u %u ",headfirst.reserved1,headfirst.reserved2);
        printf("%u\\n",headfirst.offset); 
        fin=fopen("C:/Dev-Cpp/1.bmp","rb+");         
        fread(&headsecond,sizeof(headsecond),1,fin);
      
        //Read Image Information Directory
        printf("IFD %u",headsecond.size);
        printf("%d %d %u %u %u %d %d %u %u\\n",headsecond.width,headsecond.height,headsecond.height,headsecond.bits,headsecond.compression,headsecond.imagesize,headsecond.xresolution,headsecond.yresolution,headsecond.ncolors,headsecond.impcolors);
        
        //Read Image Pixel Values
        fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
        if(fin==0)
        {return(0);
        }
        for(i=0;i<headfirst.offset;i++)
        {
                                       ch=getc(fin);//Remove Offset
        }
        i=0;
        while ((ch=fgetc(fin))!=EOF)
        {
             mat\[i\]=(int)ch;
             i++;
        }
       //mat\[\] gives me the whole array of pixels in the image
       //Now I need to co
      
      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      What is the misbehaviour? Please be specific in your posts. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      M 2 Replies Last reply
      0
      • M Mitesh Karwa

        I was developing a simple program to read an 24-bit BMP image, convert it into 8-bit intensity map and then display it as a grayscale image. Please review this code and tell me where I am getting an error...

        #include<stdio.h>
        #include<conio.h>
        #pragma pack(2)

        typedef struct
        {
        unsigned short int type;
        unsigned int size;
        unsigned short int reserved1,reserved2;
        unsigned int offset;
        }HEADER;

        typedef struct
        {
        unsigned int size;
        int width,height;
        unsigned short int bits;
        unsigned int compression;
        unsigned int imagesize;
        int xresolution,yresolution;
        unsigned int ncolors;
        unsigned int impcolors;
        }INFOHEADER;

        typedef struct
        {
        unsigned int R,G,B;
        }PIXEL;

        void main()
        {
        HEADER headfirst;
        INFOHEADER headsecond;
        PIXEL pix;
        FILE *fin,*fout,*f1;
        char *read;
        int ch=0,i,j,mat[768],R[256],G[256],B[256],Gray[256];
        float Y[256];

          //Read Image Header
          fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
          if(fin==NULL)
          {
                       printf("Error");
                       exit(0);
          }
          fread(&headfirst,sizeof(headfirst),1,fin);
          if(headfirst.type!=19778)
          {
                                   printf("Not BMP");
                                   getch();
                                   return(0);
                                   }
          printf("Header %x ",headfirst.type);
          printf("%u ",headfirst.size);
          printf("%u %u ",headfirst.reserved1,headfirst.reserved2);
          printf("%u\\n",headfirst.offset); 
          fin=fopen("C:/Dev-Cpp/1.bmp","rb+");         
          fread(&headsecond,sizeof(headsecond),1,fin);
        
          //Read Image Information Directory
          printf("IFD %u",headsecond.size);
          printf("%d %d %u %u %u %d %d %u %u\\n",headsecond.width,headsecond.height,headsecond.height,headsecond.bits,headsecond.compression,headsecond.imagesize,headsecond.xresolution,headsecond.yresolution,headsecond.ncolors,headsecond.impcolors);
          
          //Read Image Pixel Values
          fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
          if(fin==0)
          {return(0);
          }
          for(i=0;i<headfirst.offset;i++)
          {
                                         ch=getc(fin);//Remove Offset
          }
          i=0;
          while ((ch=fgetc(fin))!=EOF)
          {
               mat\[i\]=(int)ch;
               i++;
          }
         //mat\[\] gives me the whole array of pixels in the image
         //Now I need to co
        
        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        And your question we need to use of your code or it doesnt work ?

        Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

        M 1 Reply Last reply
        0
        • M Mitesh Karwa

          I was developing a simple program to read an 24-bit BMP image, convert it into 8-bit intensity map and then display it as a grayscale image. Please review this code and tell me where I am getting an error...

          #include<stdio.h>
          #include<conio.h>
          #pragma pack(2)

          typedef struct
          {
          unsigned short int type;
          unsigned int size;
          unsigned short int reserved1,reserved2;
          unsigned int offset;
          }HEADER;

          typedef struct
          {
          unsigned int size;
          int width,height;
          unsigned short int bits;
          unsigned int compression;
          unsigned int imagesize;
          int xresolution,yresolution;
          unsigned int ncolors;
          unsigned int impcolors;
          }INFOHEADER;

          typedef struct
          {
          unsigned int R,G,B;
          }PIXEL;

          void main()
          {
          HEADER headfirst;
          INFOHEADER headsecond;
          PIXEL pix;
          FILE *fin,*fout,*f1;
          char *read;
          int ch=0,i,j,mat[768],R[256],G[256],B[256],Gray[256];
          float Y[256];

            //Read Image Header
            fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
            if(fin==NULL)
            {
                         printf("Error");
                         exit(0);
            }
            fread(&headfirst,sizeof(headfirst),1,fin);
            if(headfirst.type!=19778)
            {
                                     printf("Not BMP");
                                     getch();
                                     return(0);
                                     }
            printf("Header %x ",headfirst.type);
            printf("%u ",headfirst.size);
            printf("%u %u ",headfirst.reserved1,headfirst.reserved2);
            printf("%u\\n",headfirst.offset); 
            fin=fopen("C:/Dev-Cpp/1.bmp","rb+");         
            fread(&headsecond,sizeof(headsecond),1,fin);
          
            //Read Image Information Directory
            printf("IFD %u",headsecond.size);
            printf("%d %d %u %u %u %d %d %u %u\\n",headsecond.width,headsecond.height,headsecond.height,headsecond.bits,headsecond.compression,headsecond.imagesize,headsecond.xresolution,headsecond.yresolution,headsecond.ncolors,headsecond.impcolors);
            
            //Read Image Pixel Values
            fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
            if(fin==0)
            {return(0);
            }
            for(i=0;i<headfirst.offset;i++)
            {
                                           ch=getc(fin);//Remove Offset
            }
            i=0;
            while ((ch=fgetc(fin))!=EOF)
            {
                 mat\[i\]=(int)ch;
                 i++;
            }
           //mat\[\] gives me the whole array of pixels in the image
           //Now I need to co
          
          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #4

          try it here http://www.rentacoder.com/[^] or start learning programming.

          Press F1 for help or google it. Greetings from Germany

          1 Reply Last reply
          0
          • M Mitesh Karwa

            I was developing a simple program to read an 24-bit BMP image, convert it into 8-bit intensity map and then display it as a grayscale image. Please review this code and tell me where I am getting an error...

            #include<stdio.h>
            #include<conio.h>
            #pragma pack(2)

            typedef struct
            {
            unsigned short int type;
            unsigned int size;
            unsigned short int reserved1,reserved2;
            unsigned int offset;
            }HEADER;

            typedef struct
            {
            unsigned int size;
            int width,height;
            unsigned short int bits;
            unsigned int compression;
            unsigned int imagesize;
            int xresolution,yresolution;
            unsigned int ncolors;
            unsigned int impcolors;
            }INFOHEADER;

            typedef struct
            {
            unsigned int R,G,B;
            }PIXEL;

            void main()
            {
            HEADER headfirst;
            INFOHEADER headsecond;
            PIXEL pix;
            FILE *fin,*fout,*f1;
            char *read;
            int ch=0,i,j,mat[768],R[256],G[256],B[256],Gray[256];
            float Y[256];

              //Read Image Header
              fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
              if(fin==NULL)
              {
                           printf("Error");
                           exit(0);
              }
              fread(&headfirst,sizeof(headfirst),1,fin);
              if(headfirst.type!=19778)
              {
                                       printf("Not BMP");
                                       getch();
                                       return(0);
                                       }
              printf("Header %x ",headfirst.type);
              printf("%u ",headfirst.size);
              printf("%u %u ",headfirst.reserved1,headfirst.reserved2);
              printf("%u\\n",headfirst.offset); 
              fin=fopen("C:/Dev-Cpp/1.bmp","rb+");         
              fread(&headsecond,sizeof(headsecond),1,fin);
            
              //Read Image Information Directory
              printf("IFD %u",headsecond.size);
              printf("%d %d %u %u %u %d %d %u %u\\n",headsecond.width,headsecond.height,headsecond.height,headsecond.bits,headsecond.compression,headsecond.imagesize,headsecond.xresolution,headsecond.yresolution,headsecond.ncolors,headsecond.impcolors);
              
              //Read Image Pixel Values
              fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
              if(fin==0)
              {return(0);
              }
              for(i=0;i<headfirst.offset;i++)
              {
                                             ch=getc(fin);//Remove Offset
              }
              i=0;
              while ((ch=fgetc(fin))!=EOF)
              {
                   mat\[i\]=(int)ch;
                   i++;
              }
             //mat\[\] gives me the whole array of pixels in the image
             //Now I need to co
            
            B Offline
            B Offline
            Baltoro
            wrote on last edited by
            #5

            ...Since, you are trying to read a Bitmap (presumably stored on disk), I'm assuming that you are attempting to write Windows code. Your posted code example has numerous errors. You should start by reading up on the: Bitmap Storage Format, MSDN[^]. This will explain the overall data structure of a bitmap file stored on your computer. You should become familiar with the Bitmap header structure, so that you can read the bitmap file correctly. Here is the reference for the Bitmap Header Types[^]. You should read the headers first to be sure that the image is, in fact, a 24-bit bitmap type (there are numerous variations). The preferred method is to open the bitmap file with, CreateFile. Then you can read the byte arrays in whatever way is appropriate to your applicatrion.

            M 1 Reply Last reply
            0
            • H Hamid Taebi

              And your question we need to use of your code or it doesnt work ?

              Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

              M Offline
              M Offline
              Mitesh Karwa
              wrote on last edited by
              #6

              The code does not execute

              1 Reply Last reply
              0
              • CPalliniC CPallini

                What is the misbehaviour? Please be specific in your posts. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                M Offline
                M Offline
                Mitesh Karwa
                wrote on last edited by
                #7

                The code does not execute... The image is read right to left i believe, not left to right

                CPalliniC 1 Reply Last reply
                0
                • M Mitesh Karwa

                  The code does not execute... The image is read right to left i believe, not left to right

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  Mitesh Karwa wrote:

                  The code does not execute...

                  Mitesh Karwa wrote:

                  The image is read right to left i believe, not left to right

                  The above behaviours looks quite incompatible... :rolleyes:

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  In testa che avete, signor di Ceprano?

                  M 1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    What is the misbehaviour? Please be specific in your posts. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    M Offline
                    M Offline
                    Mitesh Karwa
                    wrote on last edited by
                    #9

                    Actually the problem is that when i write to the image file, nothing gets written on the image. Do I need to include the image header and all again. If yes, how will I know the address it will point to and all that. What I have done is, in the target directory, right click and go to new -> Bitmap Image. Renamed it as 1.bmp I'm trying to write the array that contains my grayscale image to that file 1.bmp... But the code does not work. Somehow nothing gets written on it

                    1 Reply Last reply
                    0
                    • CPalliniC CPallini

                      Mitesh Karwa wrote:

                      The code does not execute...

                      Mitesh Karwa wrote:

                      The image is read right to left i believe, not left to right

                      The above behaviours looks quite incompatible... :rolleyes:

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                      [My articles]

                      M Offline
                      M Offline
                      Mitesh Karwa
                      wrote on last edited by
                      #10

                      I'm afraid I did not get you... Actually, I could not get the image written on the file I meant to. So, the code does not execute. And I am also doing the same thing in MATLAB. I got the pixel values there using imread command. On comparing, i found that the image is being read right to left. That was also my question... does imread read the image from right to left... Hope I am being clearer now. Please help me

                      CPalliniC 1 Reply Last reply
                      0
                      • B Baltoro

                        ...Since, you are trying to read a Bitmap (presumably stored on disk), I'm assuming that you are attempting to write Windows code. Your posted code example has numerous errors. You should start by reading up on the: Bitmap Storage Format, MSDN[^]. This will explain the overall data structure of a bitmap file stored on your computer. You should become familiar with the Bitmap header structure, so that you can read the bitmap file correctly. Here is the reference for the Bitmap Header Types[^]. You should read the headers first to be sure that the image is, in fact, a 24-bit bitmap type (there are numerous variations). The preferred method is to open the bitmap file with, CreateFile. Then you can read the byte arrays in whatever way is appropriate to your applicatrion.

                        M Offline
                        M Offline
                        Mitesh Karwa
                        wrote on last edited by
                        #11

                        The preferred method is to open the bitmap file with, CreateFile. I am not doing Windows Programming. I am doing a project on face recognition on C++. How do I use CreateFile on C++? Any useful links for that might be helpful

                        1 Reply Last reply
                        0
                        • M Mitesh Karwa

                          I'm afraid I did not get you... Actually, I could not get the image written on the file I meant to. So, the code does not execute. And I am also doing the same thing in MATLAB. I got the pixel values there using imread command. On comparing, i found that the image is being read right to left. That was also my question... does imread read the image from right to left... Hope I am being clearer now. Please help me

                          CPalliniC Offline
                          CPalliniC Offline
                          CPallini
                          wrote on last edited by
                          #12

                          There is a not of stuff on the web showing how to load a bitmap file, see, for instance [^]. :)

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          In testa che avete, signor di Ceprano?

                          M 1 Reply Last reply
                          0
                          • CPalliniC CPallini

                            There is a not of stuff on the web showing how to load a bitmap file, see, for instance [^]. :)

                            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                            [My articles]

                            M Offline
                            M Offline
                            Mitesh Karwa
                            wrote on last edited by
                            #13

                            I am not working on Windows Programming. In fact I have no idea about it. Still anyways, thanks for your help. It's very helpful. I'll try to fix it from here on. But what about my problem reading the image back after I have done manipulations on it... How do I write it back to another file?

                            1 Reply Last reply
                            0
                            • M Mitesh Karwa

                              I was developing a simple program to read an 24-bit BMP image, convert it into 8-bit intensity map and then display it as a grayscale image. Please review this code and tell me where I am getting an error...

                              #include<stdio.h>
                              #include<conio.h>
                              #pragma pack(2)

                              typedef struct
                              {
                              unsigned short int type;
                              unsigned int size;
                              unsigned short int reserved1,reserved2;
                              unsigned int offset;
                              }HEADER;

                              typedef struct
                              {
                              unsigned int size;
                              int width,height;
                              unsigned short int bits;
                              unsigned int compression;
                              unsigned int imagesize;
                              int xresolution,yresolution;
                              unsigned int ncolors;
                              unsigned int impcolors;
                              }INFOHEADER;

                              typedef struct
                              {
                              unsigned int R,G,B;
                              }PIXEL;

                              void main()
                              {
                              HEADER headfirst;
                              INFOHEADER headsecond;
                              PIXEL pix;
                              FILE *fin,*fout,*f1;
                              char *read;
                              int ch=0,i,j,mat[768],R[256],G[256],B[256],Gray[256];
                              float Y[256];

                                //Read Image Header
                                fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
                                if(fin==NULL)
                                {
                                             printf("Error");
                                             exit(0);
                                }
                                fread(&headfirst,sizeof(headfirst),1,fin);
                                if(headfirst.type!=19778)
                                {
                                                         printf("Not BMP");
                                                         getch();
                                                         return(0);
                                                         }
                                printf("Header %x ",headfirst.type);
                                printf("%u ",headfirst.size);
                                printf("%u %u ",headfirst.reserved1,headfirst.reserved2);
                                printf("%u\\n",headfirst.offset); 
                                fin=fopen("C:/Dev-Cpp/1.bmp","rb+");         
                                fread(&headsecond,sizeof(headsecond),1,fin);
                              
                                //Read Image Information Directory
                                printf("IFD %u",headsecond.size);
                                printf("%d %d %u %u %u %d %d %u %u\\n",headsecond.width,headsecond.height,headsecond.height,headsecond.bits,headsecond.compression,headsecond.imagesize,headsecond.xresolution,headsecond.yresolution,headsecond.ncolors,headsecond.impcolors);
                                
                                //Read Image Pixel Values
                                fin=fopen("C:/Dev-Cpp/1.bmp","rb+");
                                if(fin==0)
                                {return(0);
                                }
                                for(i=0;i<headfirst.offset;i++)
                                {
                                                               ch=getc(fin);//Remove Offset
                                }
                                i=0;
                                while ((ch=fgetc(fin))!=EOF)
                                {
                                     mat\[i\]=(int)ch;
                                     i++;
                                }
                               //mat\[\] gives me the whole array of pixels in the image
                               //Now I need to co
                              
                              X Offline
                              X Offline
                              XcentY
                              wrote on last edited by
                              #14

                              I'm actually building a BMP Reader in C And I came accross your code. I'm only in the beginning and already changed some stuff. First when you put if(headfirst.type!=19778) I see that you're not taking ENDIAN in account. I made some functions to reorder the bytes.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups