Windows Bmp or OS/2 Bmp ? Or Signed or Unsigned integer ? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Windows Bmp or OS/2 Bmp ? Or Signed or Unsigned integer ?

gyanaroragyanarora Posts: 48Member
Hi friend
How can I differntiate between OS/2 and windows Bitmap file.
Actually I have a Bmpviewer which works well for all versions of Bmp But when I try to open an OS/2 Bmp it starts performing operations without providing any output or error message.
I don't want to support OS/2 Images But want to display proper message for example "This Bmp is not supported".
So I need to differentiate these two types.

Or more specifically-

In file format specfication I have found that in Bmp width and Height of windows bitmap are signed data but in OS/2 these are unsigned.
So now more specifially I want to differentiate signed and Unsigned data types.
Regards
--Gyan

Comments

  • pingpongpingpong Posts: 937Member
    I dont know about signed and unsigned, but Windows BMP files have this layout:

    BITMAPFILEHEADER
    BITMAPINFOHEADER, BITMAPV4HEADER or BITMAPV5HEADER
    RGBQUAD (if any)
    DATA

    While OS/2 BMP's have this layout:
    BITMAPFILEHEADER
    BITMAPCOREHEADER
    RGBTRIPLE (if any)
    DATA

    As you can see, OS/2 bitmaps always have the same kind of second header. First DWORD in this second header is the size. So, after you read BITMAPFILEHEADER from the disk, read a DWORD, and if it's sizeof(BITMAPCOREHEADER) then this file is OS/2.

    : Hi friend
    : How can I differntiate between OS/2 and windows Bitmap file.
    : Actually I have a Bmpviewer which works well for all versions of Bmp But when I try to open an OS/2 Bmp it starts performing operations without providing any output or error message.
    : I don't want to support OS/2 Images But want to display proper message for example "This Bmp is not supported".
    : So I need to differentiate these two types.
    :
    : Or more specifically-
    :
    : In file format specfication I have found that in Bmp width and Height of windows bitmap are signed data but in OS/2 these are unsigned.
    : So now more specifially I want to differentiate signed and Unsigned data types.
    : Regards
    : --Gyan
    :
    :

Sign In or Register to comment.