jftuga Posted October 9, 2007 Share Posted October 9, 2007 I would like to write a program to crop an image by using imagemagick on the back-end to do the actual file manipulation and au3 for the front-end. The AutoIt UI would consist of loading a jpg with GUICtrlCreateGraphic() (or is there a better way?). Once this is loaded onto the screen, the user would click 2 points, upper left and lower right. A rectangle would be drawn with GUICtrlSetGraphic() on top of the image so that the user can see what has been cropped. Unfortunately, these 2 functions are incompatible. How can I do this in AutoIt? Once I get the 2 coordinates, then I can use RunWait() and pass these numbers off to the imagemagick convert program. Any help would be greatly appreciated. Thanks, -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 9, 2007 Moderators Share Posted October 9, 2007 I would like to write a program to crop an image by using imagemagick on the back-end to do the actual file manipulation and au3 for the front-end. The AutoIt UI would consist of loading a jpg with GUICtrlCreateGraphic() (or is there a better way?). Once this is loaded onto the screen, the user would click 2 points, upper left and lower right. A rectangle would be drawn with GUICtrlSetGraphic() on top of the image so that the user can see what has been cropped. Unfortunately, these 2 functions are incompatible. How can I do this in AutoIt? Once I get the 2 coordinates, then I can use RunWait() and pass these numbers off to the imagemagick convert program.Any help would be greatly appreciated.Thanks,-JohnI'd have a look at PaulIA's A3L library in the Example Scripts personally.... dig through those to see if you can mesh together what you are looking at doing. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ptrex Posted October 10, 2007 Share Posted October 10, 2007 (edited) @allPersonally I would go for the ImageMagick solution :Using the Crop command-crop width{%} -crop widthxheight{+-}x{+-}y{%}ImageMagickRegardsptrex Edited October 10, 2007 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
jftuga Posted October 10, 2007 Author Share Posted October 10, 2007 ptrex, I agree about using imagemagick. But I would like to have a visual AU3 frontend to make it easier to get the coordinates. Once the user clicks on these (upperleft & bottomright), I can pass these values to the imagemagick command-line program via RunWait(). Any ideas on how to do this? Thanks, -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
ptrex Posted October 10, 2007 Share Posted October 10, 2007 @jftugaNot realy but this will give you a good starting point.ImageMagick RESIZE & CROPregards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
weaponx Posted October 10, 2007 Share Posted October 10, 2007 If I could manage to dig through ElTorro's 2000 lines of code:http://www.autoitscript.com/forum/index.ph...mp;hl=rectangleI would:1. Create a GUI2. Load the image into the gui3. Use the selection portion of eltorros code to get the X1,Y1 + X2,Y24. Feed the data into ImageMagick Link to comment Share on other sites More sharing options...
inzam Posted January 20, 2011 Share Posted January 20, 2011 if you want crop any image, than i will suggest you to visit the link below http://www.raiseitsolutions.com/forum/viewtopic.php?f=4&t=2 if you visit this link, you will know how to crop an image easily thank you very much. 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