Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.