yidabu Posted April 1, 2007 Share Posted April 1, 2007 first, download ImageMagick-6.3.3-5-Q16-windows-static.exefrom: http://www.imagemagick.org/script/binary-r...ses.php#windowsinstall it with com ole supportthen save myImageIdentify() udf:expandcollapse popup;=============================================================================== ; ; Function Name: myImageIdentify ; Description:: get information from image ; Parameter(s): ; $ImgIn=image path ; $Separator= separator of $sFormat ; $sformat=string ; output formatted image characteristics. ; When used with the identify utility, use this option to print information about the image in a format of your choosing. You can include the image filename, type, width, height, Exif data, or other image attributes by embedding special format characters: ; %b file size ; %c comment ; %d directory ; %e filename extension ; %f filename ; %g page geometry ; %h height ; %i input filename ; %k number of unique colors ; %l label ; %m magick ; %n number of scenes ; %o output filename ; %p page number ; %q quantum depth ; %r image class and colorspace ; %s scene number ; %t top of filename ; %u unique temporary filename ; %w width ; %x x resolution ; %y y resolution ; %z image depth ; %C image compression type ; %D image dispose method ; %O page offset ; %P page width and height ; %Q image compression quality ; %T image delay ; %@ bounding box ; %# signature ; %% a percent sign ; \n newline ; \r carriage return ; www/command-line-options.html#format ; Requirement(s): install ImageMagick-6.3.3-5-Q16-windows-static.exe ; download url: http://www.imagemagick.org/script/binary-releases.php#windows ; Return Value(s): ; Author(s): autoit论坛 http://bbs.yidabu.com/forum-2-1.html ; ;=============================================================================== ; Func myImageIdentify($ImgIn,$sFormat,$Separator=",") Local $FuncName="myImageIdentify" local $oIM local $Return $oIM = ObjCreate("ImageMagickObject.MagickImage") If Not IsObj($oIM) Then ConsoleWrite($FuncName & " " & @ScriptLineNumber & ": not obj, maybe you not installed Image magick" & @LF) Return 0 endif $Return=$oIM.Identify("-format",$sFormat,$ImgIn) If StringInStr($Return,$Separator) Then $Return=StringRegExp($Return,"(.+?)(?:\" & $Separator & "|$)",3) Return $Return EndFuncoÝ÷ ÙìZ^jëh×6Local $ImgIn="D:\My Documents\My Pictures\yidabu.jpg" Local $sFormat="%w,%h,%b" Local $Info=myImageIdentify($ImgIn,$sFormat) Local $ImgWidth=$Info[0] MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$ImgWidth' & @lf & @lf & 'Return:' & @lf & $ImgWidth & @lf & @lf & '@Error:' & @lf & @Error) ;### Debug MSGBOX Local $ImgHeight=$Info[1] MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$ImgHeight' & @lf & @lf & 'Return:' & @lf & $ImgHeight & @lf & @lf & '@Error:' & @lf & @Error) ;### Debug MSGBOX Local $ImgSize=$Info[2] MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$ImgSize' & @lf & @lf & 'Return:' & @lf & $ImgSize & @lf & @lf & '@Error:' & @lf & @Error) ;### Debug MSGBOX my UDF:myReplaceStringInFile suport StringRegExp and subdirectorymyFileListToArray suport StringRegExp and subdirectorymyImageIdentify get all information from image, use Image Magick com supportautoit in Chinaautoit 论坛yidabu成功社区 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