Skip to main content

[archive] Bitmaps

  • March 16, 2010
  • 5 replies
  • 0 views

[Migrated content. Thread originally posted on 16 March 2010]

What I want to do is get the height and width of a given 24bit bitmap.

01 IMAGE-HANDLE HANDLE OF BITMAP.
01 bm-height pic 9(05).
01 bm-width pic 9(05).


CALL "W$BITMAP" USING WBITMAP-LOAD,
BITMAP-FILENAME, GIVING IMAGE-HANDLE

INQUIRE IMAGE-HANDLE BITMAP-RAW-HEIGHT IN BM-HEIGHT
INQUIRE IMAGE-HANDLE BITMAP-RAW-WIDTH IN BM-WIDTH

It seems to me that this should work, however BM-HEIGHT and BM-WIDTH are always zero (0). Any ideas appreciated.

5 replies

[Migrated content. Thread originally posted on 16 March 2010]

What I want to do is get the height and width of a given 24bit bitmap.

01 IMAGE-HANDLE HANDLE OF BITMAP.
01 bm-height pic 9(05).
01 bm-width pic 9(05).


CALL "W$BITMAP" USING WBITMAP-LOAD,
BITMAP-FILENAME, GIVING IMAGE-HANDLE

INQUIRE IMAGE-HANDLE BITMAP-RAW-HEIGHT IN BM-HEIGHT
INQUIRE IMAGE-HANDLE BITMAP-RAW-WIDTH IN BM-WIDTH

It seems to me that this should work, however BM-HEIGHT and BM-WIDTH are always zero (0). Any ideas appreciated.
I never could figure out any other way than to read the .bmp file sequentially and pull out the height and width from the first few characters.

       
       01  tmpInt.
            05 intImageSize   USAGE IS UNSIGNED-INT.
       01  WS-IMAGE-WIDTH   PIC  9(4).
       01  WS-IMAGE-HEIGHT  PIC  9(4).

MOVE IMAGE-RECORD(19:4) TO tmpInt.
MOVE intImageSize       TO WS-IMAGE-WIDTH.
MOVE IMAGE-RECORD(23:4) TO tmpInt.
MOVE intImageSize       TO WS-IMAGE-HEIGHT.

[Migrated content. Thread originally posted on 16 March 2010]

What I want to do is get the height and width of a given 24bit bitmap.

01 IMAGE-HANDLE HANDLE OF BITMAP.
01 bm-height pic 9(05).
01 bm-width pic 9(05).


CALL "W$BITMAP" USING WBITMAP-LOAD,
BITMAP-FILENAME, GIVING IMAGE-HANDLE

INQUIRE IMAGE-HANDLE BITMAP-RAW-HEIGHT IN BM-HEIGHT
INQUIRE IMAGE-HANDLE BITMAP-RAW-WIDTH IN BM-WIDTH

It seems to me that this should work, however BM-HEIGHT and BM-WIDTH are always zero (0). Any ideas appreciated.
You may want to try WBITMAP-LOAD-PICTURE, this will give you a picture object, which among other things also will tell the width and height of supported graphics.
There is a good example of this in the documentation.

[Migrated content. Thread originally posted on 16 March 2010]

What I want to do is get the height and width of a given 24bit bitmap.

01 IMAGE-HANDLE HANDLE OF BITMAP.
01 bm-height pic 9(05).
01 bm-width pic 9(05).


CALL "W$BITMAP" USING WBITMAP-LOAD,
BITMAP-FILENAME, GIVING IMAGE-HANDLE

INQUIRE IMAGE-HANDLE BITMAP-RAW-HEIGHT IN BM-HEIGHT
INQUIRE IMAGE-HANDLE BITMAP-RAW-WIDTH IN BM-WIDTH

It seems to me that this should work, however BM-HEIGHT and BM-WIDTH are always zero (0). Any ideas appreciated.
You may want to try WBITMAP-LOAD-PICTURE, this will give you a picture object, which among other things also will tell the width and height of supported graphics.
There is a good example of this in the documentation.

[Migrated content. Thread originally posted on 16 March 2010]

What I want to do is get the height and width of a given 24bit bitmap.

01 IMAGE-HANDLE HANDLE OF BITMAP.
01 bm-height pic 9(05).
01 bm-width pic 9(05).


CALL "W$BITMAP" USING WBITMAP-LOAD,
BITMAP-FILENAME, GIVING IMAGE-HANDLE

INQUIRE IMAGE-HANDLE BITMAP-RAW-HEIGHT IN BM-HEIGHT
INQUIRE IMAGE-HANDLE BITMAP-RAW-WIDTH IN BM-WIDTH

It seems to me that this should work, however BM-HEIGHT and BM-WIDTH are always zero (0). Any ideas appreciated.
You may want to try WBITMAP-LOAD-PICTURE, this will give you a picture object, which among other things also will tell the width and height of supported graphics.
There is a good example of this in the documentation.

[Migrated content. Thread originally posted on 16 March 2010]

What I want to do is get the height and width of a given 24bit bitmap.

01 IMAGE-HANDLE HANDLE OF BITMAP.
01 bm-height pic 9(05).
01 bm-width pic 9(05).


CALL "W$BITMAP" USING WBITMAP-LOAD,
BITMAP-FILENAME, GIVING IMAGE-HANDLE

INQUIRE IMAGE-HANDLE BITMAP-RAW-HEIGHT IN BM-HEIGHT
INQUIRE IMAGE-HANDLE BITMAP-RAW-WIDTH IN BM-WIDTH

It seems to me that this should work, however BM-HEIGHT and BM-WIDTH are always zero (0). Any ideas appreciated.
I've found that I have to DISPLAY the bitmap after loading it with W$BITMAP in order for BITMAP-RAW-HEIGHT or BITMAP-RAW-WIDTH to give a valid value.