suthers Posted March 6, 2009 Share Posted March 6, 2009 Hi All, Is there a way to find the width & height in pixels of the image in a JPG file? Shalom Bill Link to comment Share on other sites More sharing options...
Malkey Posted March 6, 2009 Share Posted March 6, 2009 Hi All,Is there a way to find the width & height in pixels of the image in a JPG file?ShalomBillSee:-_GDIPlus_ImageLoadFromFile _GDIPlus_ImageGetWidth _GDIPlus_ImageGetHeight Examples in help file. Link to comment Share on other sites More sharing options...
suthers Posted March 6, 2009 Author Share Posted March 6, 2009 Great! Just what I need. I did search the help file, but obviously not using the right terms to find that. Thanks again. Bill Link to comment Share on other sites More sharing options...
NiVZ Posted March 6, 2009 Share Posted March 6, 2009 If you want to avoid GDI, you can use this (modified from antoher script on this forum - sorry can't remember who's) $PathToImage = "C:\Test.jpg" $ImgDimensions = _GetImageDimensions($PathToImage) Msgbox(0, "Image Dimensions", $ImgDimensions[0] & " x " & $ImgDimensions[1] & @CRLF) Func _GetImageDimensions($sPath) $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1)) $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1))) $oShellApp = ObjCreate ("shell.application") $oDir = $oShellApp.NameSpace ($sDir) $oFile = $oDir.Parsename ($sFile) Dim $sProperty[2] $sProperty[0] = StringTrimRight($oDir.GetDetailsOf ($oFile, 27), 7) $sProperty[1] = StringTrimRight($oDir.GetDetailsOf ($oFile, 28), 7) If $sProperty = "" Then Return 0 Else Return $sProperty EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now