I need to get the height
and width
properties from a .PNG
File using VBScript
.
I'm currently using loadpicture()
which does well with other formats e.g. .JPG
, .gifs
, .ico
, .bmp
, and others. However, it does not support the .PNG
file format.
The result I'm looking for is that the file is found and the height/width is returned. No other properties are needed.
Currently with loadpicture()
it reports back with:
invalid file format
The code I am working with is:
Set myImg = LoadPicture(imageName)
imgWidth = Round(myImg.width / 26.4583)
imgHeight = Round(myImg.height / 26.4583)
Set myImg = Nothing
This works with many file formats. However, it does not work with .PNG
I must add that it is essential that I'm able to get height and width from .PNG
files as the images are submitted by other users and they will need to be scaled so that they aren't overstretched/squished when resized.
I'm unfortunately unable to install any other programs to assist me with this but I'm wondering if it's possible using VBScript alone?
The difference for this question compared to older questions is that I'm unable to install or add third party software. I may possibly be able to get away with adding code files that originate as .txt
but security is very tight. Thanks.