Skip to main content

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
i found this source in my sample-directory... hope this helps :)

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
Frosti;

Much appreciated, I will give it a try.

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
Frosti;

Much appreciated, I will give it a try.

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
Frosti;

Much appreciated, I will give it a try.

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
Frosti;

That did the trick, I suppose I should be able to get the same information for a .jpg file once I figure out the offset.

Again;

Thank you.

Alex

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
jpg is a bit complicated - because it could have a thumbnail :(

I started long time ago to figure out the size from a jpg but never finished it...

Byte 1 2 should be x"FFD8" to validate that it is an jpg.
After this you should search for x"C0", x"C1", x"C2" or x"C3"
after this follow a x"0011" and then 2 bytes for y and x size.

you should search for 2 entries (for example for x"c0" and x"c1") because a jpg could have a thumbnail and the first antry is the size for it - so if a thumbnail is in - the 2nd entrie should be the right one :)

here is my test-source but as i told - i never figured out 100% how it really work to get the size 100%


       file-control.
           select image-file assign to image-filename
                  organization      is binary sequential
                  access mode       is sequential.
       data division.
       file section.
       fd  image-file.
       01  image-record           pic x(32000).

...

       working-storage section.
      ***  Image
       78  newline                               value x"0A".
       77  image-filename         pic x(11) value
           "c:\\mage.jpg".

       77  image-width            pic 9(6).
       77  image-height           pic 9(6).

       01  tmp-width.
           03  int-width          usage unsigned_int.
       01  tmp-height.
           03  int-height         usage unsigned_int.

       77  getpicinfo-x           pic x(8) comp-x.

       77  ascii                  pic x(4).
       01  hex                    pic x(2).
       01  hex-re redefines hex   pic x(2) comp-x.

       77  idx                    pic 9(5)       value zeroes.

....

       info-image section.
           open input image-file.
           read image-file.

           evaluate image-record(1:2)
              when x"FFD8" display message box "JPG validated"
              when other   continue
           end-evaluate.

           move 2 to idx.

       info-image-100.
           compute idx = idx 1.
           if idx > 31997 go to info-image-900.

           evaluate image-record(idx:4)
              when x"FFC00011"
                   display message box "C0 found" newline idx
                   compute idx = idx 5 end-compute
                   if image-record(idx:2) = x"0151"
                      display message box "heigh found"
                      move    image-record(idx:2) to hex
                      display message box hex-re
                   end-if
                   compute idx = idx 2 end-compute
                   if image-record(idx:2) = x"01c2"
                      display message box "width found"
                      move    image-record(idx:2) to hex
                      display message box hex-re
                   end-if
                   go to info-image-110
              when x"FFC10011"
                   display message box "C1 found"
              when x"FFC20011"
                   display message box "C2 found"
              when x"FFC30011"
                   display message box "C3 found"
           end-evaluate.

           go to info-image-100.

       info-image-110.

           display main-screen.

       info-image-900.
           close image-file.

       info-image-ende.
           exit.
       info-image-e.

....




Another solution should be:
i get this from the german acu-support...

acucobol use for image-handling the "VIC32.DLL". For image size you could use "bmpinfo" and "jpeginfo". A documantation to the .dll can be found here: http://www.catenary.com/docs/cont2f.html

But i didn't tested it...

Nut much infos from my side but this is all that i know at the moment :( And sorry for my bad english :)

David

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
Found this from another language...
http://www.bigbold.com/snippets/posts/show/805

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
Found this from another language...
http://www.bigbold.com/snippets/posts/show/805

[Migrated content. Thread originally posted on 28 February 2006]

Does anyone have any experience in retrieving the demensions of a bitmap file. What I want to do is create a dynamic display of an image on the screen based on the image's width and height.
Found this from another language...
http://www.bigbold.com/snippets/posts/show/805