Height and width of an image

vdennis

Member
Hi all. I am trying to figure out how to determine the height and width of an image. I have an excel worksheet that I load pictures into at exact points, so I am having to use the AddPicture method. Works fine is the image is 'square' say 50 by 50. But we have some that are not and therefore the picture comes out distorted. (See article P23999/p) If I could determine the ratio between H and W, I could adjust the values for that difference.
Thanks!
-Dennis-
 

jongpau

Member
Provided you are on OE10 or higher and on Windows (you forgot to mention this) you can do something like this:

Code:
USING System.Drawing.* FROM ASSEMBLY.
 
DEFINE VARIABLE oImg AS Bitmap NO-UNDO.
 
oImg = NEW Bitmap("<path to image file>").
MESSAGE "Size is" oImg:WIDTH "by" oImg:HEIGHT "pixels".
DELETE OBJECT oImg.
 

vdennis

Member
Thanks for the tip.
Yes, OE 10 plus and W7, so I'll give it a try. Most pic's we have are squared (50 by 50) or so, but those that are not have always caused a problem. For reports, I use Crystal Reports which can work with these oddities, but excel no. I'll let you know.
-Dennis-
 

vdennis

Member
We are now looking into a batch program to re-size on the fly, a call from progress. Nothing yet. :>(
 

jongpau

Member
We are now looking into a batch program to re-size on the fly, a call from progress. Nothing yet. :>(
And like the example I posted to check the width you can also use .Net libraries to resize images, save them in a different file format etc etc. All you need to do is use your friend Google and your imagination :)
 
Top