Highlighted
Absent Member.
Absent Member.
394 views

[archive] Bitmaps

[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.
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Bitmaps

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Bitmaps

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Bitmaps

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.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.