bmp file issues

Discussion in 'C Programming' started by steve, Aug 18, 2008.

  1. steve

    steve Guest

    I am reading in a bitmap file using the microsoft bmp classes and most
    all of the files are as follows

    Width :640:
    Height :480:
    Bits :8:
    Upside Down :1:
    Core :0:
    Palette Size :256:
    Compression :0:

    and are indexed images. Using fread and fseek to pull off the header
    and start reading at the first pixel. When I get the indexed pixel
    values and compare them to values in Photoshop they do not match. I
    have read that bitmaps are "upside down". Do I need to flip things
    around? I am assuming the header is 1077 bytes (0x0 through 0x436).

    Thanks
    steve, Aug 18, 2008
    #1
    1. Advertising

  2. steve

    Bartc Guest

    "steve" <> wrote in message
    news:...
    >I am reading in a bitmap file using the microsoft bmp classes and most
    > all of the files are as follows
    >
    > Width :640:
    > Height :480:
    > Bits :8:
    > Upside Down :1:
    > Core :0:
    > Palette Size :256:
    > Compression :0:
    >
    > and are indexed images. Using fread and fseek to pull off the header
    > and start reading at the first pixel. When I get the indexed pixel
    > values and compare them to values in Photoshop they do not match. I
    > have read that bitmaps are "upside down". Do I need to flip things
    > around? I am assuming the header is 1077 bytes (0x0 through 0x436).


    I make that 1078 bytes: 54 header stuff and 256x4 bytes of palette data.

    In what way do the values not match? Is Photoshop giving you 8-bit pixel
    values, or converting these to RGB?

    There is some confusion sometimes with RGB order, some parts might use BGR.

    The upside down flag is to do with whether the first scan line comes first,
    or last. If the latter, and you are comparing pixel (0,0), then it might
    well give a mismatch, as Photoshop will likely flip the image automatically.

    --
    Bartc
    Bartc, Aug 18, 2008
    #2
    1. Advertising

  3. On Mon, 18 Aug 2008 10:18:17 -0700 (PDT), steve
    <> wrote:

    >I am reading in a bitmap file using the microsoft bmp classes and most
    >all of the files are as follows


    C supports classes?

    >
    >Width :640:
    >Height :480:
    >Bits :8:
    >Upside Down :1:
    >Core :0:
    >Palette Size :256:
    >Compression :0:
    >
    >and are indexed images. Using fread and fseek to pull off the header
    >and start reading at the first pixel. When I get the indexed pixel
    >values and compare them to values in Photoshop they do not match. I
    >have read that bitmaps are "upside down". Do I need to flip things
    >around? I am assuming the header is 1077 bytes (0x0 through 0x436).


    And your question about the C language (as opposed to your program
    logic) is?

    --
    Remove del for email
    Barry Schwarz, Aug 19, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harry Simpson

    32 dpp BMP to 24dpp BMP??

    Harry Simpson, Oct 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    344
    Harry Simpson
    Oct 30, 2003
  2. timothy ma and constance lee

    re: java code for converting tiff image file to bmp file

    timothy ma and constance lee, Aug 26, 2007, in forum: Java
    Replies:
    4
    Views:
    744
    timothy ma and constance lee
    Aug 26, 2007
  3. Djames Suhanko
    Replies:
    1
    Views:
    2,002
  4. Kamaljeet Saini
    Replies:
    17
    Views:
    421
    Kamaljeet Saini
    Feb 4, 2009
  5. Kane
    Replies:
    6
    Views:
    111
    Alan J. Flavell
    Sep 11, 2005
Loading...

Share This Page