jaberwacky Posted August 1, 2010 Share Posted August 1, 2010 (edited) ImageMagickObject ObjectDescription:ImageMagickObject Object allows you to quickly and easily use ImageMagick in your AutoIt scripts. If you're used to using objects in your scripts/programs then you can easily pick up on using ImageMagickObject Object. For those of you new to objects then I will provide a small usage example here. A more comprehensive example is included in the zip folder. As of now a lot of functionality could be added to the UDF, however, that could take a while so I decided to release early and often. Please inform me of any bugs that you encounter.Example:#include "AutoItObject.au3" #include "ImageMagickObject Object.au3" ; directories Global Const $testImage = @ScriptDir & "\Test Images\Image4.jpg" Global Const $DestinationDir = @ScriptDir & "\Pictures\" _AutoItObject_Startup() Global $ImageMagick = ImageMagickObject() $ImageMagick.Startup() $ImageMagick.Paint($testImage, $DestinationDir & "Paint.jpg", 1.5) ; Makes your image look like an oil painting. $ImageMagick.Resize($testImage, $DestinationDir & "Resize400.jpg", 400) $ImageMagick.Shutdown() $ImageMagick = 0 _AutoItObject_Shutdown() Current functions:AdaptiveBlurAdaptiveResizeAdaptiveSharpenAnnotateAppendAutoGammaAutoLevelAutoOrientBlackThresholdBlueShiftBlurBrightnessCharcoalClipBoardCMYKColorizeCommentContrastCropDecipherDirectoryEncipherExtensionFileNameFilesizeHeightImageInfoImplodeListTypesManualModulateMonochromeNameNegateNormalizePageGeometryPaintResizeRotateSpreadStartUpThumbnailWidth Usage Instructions:1) -- because I think AutoItObject is a great way to structure UDFs!2) Download the latest ImageMagick binary from: (ImageMagick-#.#.#-#-Q16-windows-static). Install ImageMagick and be sure to choose: "Install ImageMagickObject OLE control for VBScript ..." Confirmed working on 6.6.6.9!3) Zip Folder -- contains the proper directory structure, five test images, and other required files. After you have unzipped the zip folder to your desired directory then create two au3 files named "ImageMagickObject Object.au3" and "Example.au3" in that same directory. Copy the code from this page into "ImageMagickObject Object.au3". Next, copy the code from this page into the "example.au3". Updates:[stardate: 11-24-2010] -- Captain's Log -- works now, thank you trancexx and Werty![update: 10-05-2010][update: 09-27-2010] -- New functions and bug fixes all across the board.[update: 09-01-2010] -- Bug fixes, particularly to the "Append" method.[update: 08-21-2010] -- More functions added.[update: 08-03-2010] -- More functions. Edited May 4, 2011 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
trancexx Posted August 2, 2010 Share Posted August 2, 2010 Cool. You have my vote. Btw, I'm on x64 system and it always take half an hour for me to realize that's the reason this kind of stuff doesn't work for me for that half an hour. You could start your script by adding the check of @AutoItX64 and notification of incompatibility when that is in fact the case. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
jaberwacky Posted August 3, 2010 Author Share Posted August 3, 2010 Cool.You have my vote. Btw, I'm on x64 system and it always take half an hour for me to realize that's the reason this kind of stuff doesn't work for me for that half an hour. You could start your script by adding the check of @AutoItX64 and notification of incompatibility when that is in fact the case.Thank you TranceXX. I appreciate that. I apologize that you spent a half an hour on this. As for an x64 system. My system is 64 too but it works for me. How should this be so? I also have AutoIt set up to use the 32 bit version automatically. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 3, 2010 Share Posted August 3, 2010 Many people (including me and probably trancexx) have their x64 systems set to run x64 AutoIt by default. It's much handier if most of your scripts work in x64 as you can easily change with #AutoIt3Wrapper_UseX64 what to use from SciTE. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jaberwacky Posted August 3, 2010 Author Share Posted August 3, 2010 (edited) But can't 32 bit scripts run on x64 machines? Edited August 3, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
ValeryVal Posted August 3, 2010 Share Posted August 3, 2010 Thank you. Do you know that your scripts are working with ImageMagickObject.dll from GraphicsMagick, too?BTW. Binary package of GraphicsMagick is just about 5 Mb. The point of world view Link to comment Share on other sites More sharing options...
jaberwacky Posted August 3, 2010 Author Share Posted August 3, 2010 Thank you. Do you know that your scripts are working with ImageMagickObject.dll from GraphicsMagick, too?BTW. Binary package of GraphicsMagick is just about 5 Mb. Nice, I think I'll make the switch!So you had no problems with my script? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
ValeryVal Posted August 3, 2010 Share Posted August 3, 2010 So you had no problems with my script?I'm not Tony Hayward and your script isn't oil spill in gulf of Mexico, I think. The point of world view Link to comment Share on other sites More sharing options...
Carlo84 Posted August 14, 2010 Share Posted August 14, 2010 (edited) Funny how Google only showed me this just after i spend days on getting this to work I found all newer versions of imagemagick to have a whole lot of glitches in it, while the really old ones worked great.Thank you Valery for your GraphicsMagick tip that makes quite a diffrence using 369KB dll from GraphicsMagick opposed to the 6,08MB dll from Imagemagick.It does makes one wonder though, with such an extreme difference in filesize if there arent some more limitations in the GraphicsMagick's one. especially concidering its a derivation of Imagemagick.I havent installed the GraphicsMagick nor the Imagemagick, ive only registered the dll included in GraphicsMagick and everything seems to work fine so far.Anyways ill have a look at your scripts now and see how that works thanks Edited August 15, 2010 by Hellstrong _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
jaberwacky Posted August 14, 2010 Author Share Posted August 14, 2010 I've been thinking about including the DLL for some time now but I never get around to it because I never finish anything I start. I did try the GraphicksMagick dll and though some things that didn't work in ImageMagick worked in GraphicksMagick there were things that didn't work that worked in ImageMagick. Go figure! Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Carlo84 Posted August 14, 2010 Share Posted August 14, 2010 (edited) I've been thinking about including the DLL for some time now but I never get around to it because I never finish anything I start. I did try the GraphicksMagick dll and though some things that didn't work in ImageMagick worked in GraphicksMagick there were things that didn't work that worked in ImageMagick. Go figure!hmm intresting, give it a ry with this version of imagemagick, i have a feeling everything will work on that one So far it did for me at least.I hope i can use graphicmagick for the app im working on though. PS: anyone looked into the ffmpeg.dll or sharpFFMPEG.dll ? having a hard time finding info on that. and using the EXE's makes screenrecording go to slowEDIT: i found out i cant register the dll outside the install dir, unless the other files are present too, so its dependent on some of the other stuff in there unlike the Imagemagick dll, that explains the extreme file size differences, im gonna have to figure out what files it uses, and see how big the total file size will be.EDIT 2: you need all the DLL's of graphicmagic to include it into your program, witch adds a 7,99 MB filesize.. while using Imagemagic you just have a single file of 6 MB.So i think its deffinatly worth it to stick with Imagemagick unless theres some things not working. Edited August 14, 2010 by Hellstrong _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
jaberwacky Posted August 14, 2010 Author Share Posted August 14, 2010 So i think its deffinatly worth it to stick with Imagemagick unless theres some things not working.Dangit, just as I made some headway into converting this over to graphicsmagick, lulz, it's cool, I keep revisions on Google Code. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted August 21, 2010 Author Share Posted August 21, 2010 Latest update brings several new functions to the table. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Carlo84 Posted August 23, 2010 Share Posted August 23, 2010 (edited) Latest update brings several new functions to the table. Thanks jaberwocky6669 your work has been extremely educating to me. This might be a real stupid question... i know wat "Const" does. but what does it do in the function parameters? Func IM_AdaptiveBlur($This, Const $Image, Const $Dest, Const $Radius, Const $Sigma = 1) Edited August 23, 2010 by Hellstrong _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
jaberwacky Posted August 24, 2010 Author Share Posted August 24, 2010 (edited) Thanks jaberwocky6669 your work has been extremely educating to me. This might be a real stupid question... i know wat "Const" does. but what does it do in the function parameters? Func IM_AdaptiveBlur($This, Const $Image, Const $Dest, Const $Radius, Const $Sigma = 1) Declaring a function parameter Const tells whoever uses that function that whatever arguments they pass will not be changed. I think it has something to do with maintaining state. I'm trying to learn software development as well as scripting so I may be wrong. Edited August 24, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Carlo84 Posted August 25, 2010 Share Posted August 25, 2010 (edited) Declaring a function parameter Const tells whoever uses that function that whatever arguments they pass will not be changed. I think it has something to do with maintaining state. I'm trying to learn software development as well as scripting so I may be wrong. thanks, that makes sense and very usefull Back on topic. I was making a small app for personal use to have my textures colored using a CMYK color model. So theres 2 things i looked at: -colorize value But it only uses CMY (cyan, magenta, yellow) and doesnt have a black key Then theres -modulate brightness[,saturation,hue] Witch could be used to get a CMYK output, but it handles the image in a different way so you'll get a similar but different (undesirable) effect. So the key to get the effect desired is using both of them, witch is also the power of imagemagick combining stuff. We need the colorize value changed and use the brightness value as black-key. Heres a simplyfied part of my script on how to clorize using CMYK values. $Cyan=100 $Magenta=100 $Yellow=0 $brightness=60 $saturation=100 $ImageMagick.Convert( _ "ImageIn.jpg", _ "-colorize", $Cyan & "," & $Magenta & "," & $Yellow, _ "-modulate", $brightness&","&$saturation, _ "ImageOut.jpg") Now the thing is, it has to be done in 1 conversion only like above.1st changing the saturation and then converting it again changing the colorize command, gives a total different effect. How would we do this using your UDF? [Edit] I was kinda wrong It just didn't work right cause of the order to convert in, although theres a small diffrence in color doing it in 2 exports so its still desirable. $ImageMagick = ObjCreate("ImageMagickObject.MagickImage.1") IM_CMYKcolorize("white.jpg", "white_converted.jpg", 0, 57, 57, 39) Func IM_CMYKcolorize(Const $ImageIn, Const $ImageOut, Const $Cyan, Const $Magenta, Const $Yellow, Const $black = 0, Const $saturation = 100) $ImageMagick.Convert( _ $ImageIn, _ "-colorize", $Cyan & "," & $Magenta & "," & $Yellow, _ $ImageOut) $ImageMagick.Convert( _ $ImageOut, _ "-modulate", 100 - $black & "," & $saturation, _ ;<== we invert the brightness as it will be used as black-key instead $ImageOut) EndFunc ;==>IM_CMYKcolorize Edited August 25, 2010 by Hellstrong _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
Carlo84 Posted August 25, 2010 Share Posted August 25, 2010 (edited) Heres a Visual:CMYK color model in GIMP:My Functions Input > Output > My Function:$ImageMagick = ObjCreate("ImageMagickObject.MagickImage.1") IM_CMYKcolorize("white.jpg", "white_converted.jpg", 0, 57, 57, 39) Func IM_CMYKcolorize(Const $ImageIn, Const $ImageOut, Const $Cyan, Const $Magenta, Const $Yellow, Const $black = 0, Const $saturation = 100) $ImageMagick.Convert( _ $ImageIn, _ "-colorize", $Cyan & "," & $Magenta & "," & $Yellow, _ "-modulate", 100 - $black & "," & $saturation, _ ;<== we invert the brightness as it will be used as black-key instead $ImageOut) EndFunc ;==>IM_CMYKcolorize Edited August 25, 2010 by Hellstrong _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
jaberwacky Posted August 26, 2010 Author Share Posted August 26, 2010 (edited) I guess I don't understand, did you find the solution? What exactly do you want to do? Give me a step by step of what you're doing. If possible gim'me some code. Btw, you don't have to do this: $ImageMagick = ObjCreate("ImageMagickObject.MagickImage.1") You simply do this: Global $ImageMagick = ImageMagickObject() ; thsi is the same as: "$ImageMagick = ObjCreate("ImageMagickObject.MagickImage.1")" $ImageMagick.Startup(True) ; do your image processing here... ;don't forget to shut everything down: $ImageMagick.ShutDown() ; nighty night Also, consider making a thread for this in the helpsection so we don't flood this forum. Edited August 26, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted September 27, 2010 Author Share Posted September 27, 2010 Latest udate sees a couple of new functions brought aboard and the sailor's quarters have been fumigated. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Werty Posted September 27, 2010 Share Posted September 27, 2010 Btw, you don't have to do this: $ImageMagick = ObjCreate("ImageMagickObject.MagickImage.1") You simply do this: Global $ImageMagick = ImageMagickObject() ; thsi is the same as: "$ImageMagick = ObjCreate("ImageMagickObject.MagickImage.1")" $ImageMagick.Startup(True) ; do your image processing here... ;don't forget to shut everything down: $ImageMagick.ShutDown() ; nighty night What is the difference between those methods, you saying "you dont have to do this" sounds like it's bad. (I'm using the first method myself currently, but if it's better to use the other) Some guy's script + some other guy's script = my script! 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