Generator Posted November 26, 2007 Share Posted November 26, 2007 (edited) Image Converter Features: Convert Multi Image Files at OnceMany extension Selectable, JPG, BMP, TIF, GIF, PNGFriendly user interfaceHigh performance, reduce sleep if neededCheckbox system ;Thanks to smashlyMulti-Images Drag&Drop ;Thanks to smashlyIt's in AutoIt ;D, big thanks to GaryFrost for the Library updateKnown Issues: NoneSource Code: ;See Attachment Edited November 29, 2007 by Generator Link to comment Share on other sites More sharing options...
ValeryVal Posted November 26, 2007 Share Posted November 26, 2007 About Image Viewer see:here The point of world view Link to comment Share on other sites More sharing options...
LOULOU Posted November 26, 2007 Share Posted November 26, 2007 About Image Viewer see:hereHave you an example on how to reduce the number of color and how to crop an image ?Thanks Link to comment Share on other sites More sharing options...
ValeryVal Posted November 26, 2007 Share Posted November 26, 2007 Early this can be done by _GDIP_BitmapCloneArea from Auto3Lib. The point of world view Link to comment Share on other sites More sharing options...
timgames Posted November 26, 2007 Share Posted November 26, 2007 For me it does not work, it says i need "GUIComboBox.au3" and "GDIPlus.au3" I already have the latest beta Link to comment Share on other sites More sharing options...
ptrex Posted November 26, 2007 Share Posted November 26, 2007 @Generator Perfect, but I am in need of an image RESIZER to schrink the size to the files. would that be possible to add ? regards, 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...
ashley Posted November 26, 2007 Share Posted November 26, 2007 Vrey nice, soemtime when i open the converted image it cannot preview... but if i make it do 2 at any one time then thats fixed... and im not on about the prieview that you cannot get working, im taking about when it click on where i saved it. Free icons for your programs Link to comment Share on other sites More sharing options...
ashley Posted November 26, 2007 Share Posted November 26, 2007 @Generator I did this while trying to fix the preview bug for you, I could'nt fix it, maybe it a bug with the latest autoit... Well Generator you may use this as you want just please give credit... NO BODY EXCEPT GENERATOR CAN USE THIS WITHOUR HIS PERMISSON AS ITS HIS SCRIPT. expandcollapse popup#include <GUIConstants.au3> #include <GUIComboBox.au3> #include <Array.au3> #include <GuiListView.au3> #include <Misc.au3> #include <GDIPlus.au3> #NoTrayIcon _Singleton("Image Converter") Opt("GUIOnEventMode", 1) Global $savedir = @DesktopDir & "\", $Valid Global $Image, $readpic Dim $oTypes, $oFiles[3], $hFiles[1] $mainfrm = GUICreate("Image Converter", 544, 355, 193, 125, $WS_MINIMIZEBOX + $WS_CAPTION + $WS_SYSMENU, $WS_EX_ACCEPTFILES + $WS_EX_CLIENTEDGE) $Dirinput = GUICtrlCreateInput($savedir, 8, 8, 425, 25, $ES_READONLY) $Browse = GUICtrlCreateButton("Browse", 440, 8, 97, 25, 0) $FileList = GUICtrlCreateListView("File Name|File Directory|File Size", 8, 40, 249, 273, $LVS_SHOWSELALWAYS, $WS_EX_ACCEPTFILES) $FileType = GUICtrlCreateCombo("", 264, 40, 273, 30, $CBS_DROPDOWNLIST) GUICtrlSetData($FileType, "PNG|JPG|BMP|TIF|GIF", "PNG") _GUICtrlComboBox_SetCurSel($FileType, 0) $Group = GUICtrlCreateGroup("Image Preview", 264, 64, 273, 248) $Convert = GUICtrlCreateButton("Convert Images Now", 8, 315, 124, 19, 0) $Preview = GUICtrlCreateButton("Preview", 135, 315, 124, 19, 0) $Progress = GUICtrlCreateProgress(264, 315, 273, 25) $Input1 = GUICtrlCreateInput("", 8, 335, 250, 17) GUICtrlSetFont($Dirinput, 9, 400, 0, "Tahoma") GUICtrlSetFont($Browse, 9, 400, 0, "Tahoma") GUICtrlSetFont($FileType, 9, 400, 0, "Tahoma") GUICtrlSetFont($Convert, 9, 400, 0, "Tahoma") GUICtrlSetOnEvent($Browse, "_Browse") GUISetOnEvent($GUI_EVENT_DROPPED, "_DropFile") GUISetOnEvent($GUI_EVENT_CLOSE, "_Bye") GUICtrlSetState($FileList, $GUI_DROPACCEPTED) GUICtrlSetOnEvent($Convert, "_Convert") GUICtrlSetOnEvent($Preview, "_Preview") GUISetState() $oTypes = _ArrayCreate("PNG", "JPG", "BMP", "TIF", "GIF") _GDIPlus_Startup() While 1 Sleep(1) WEnd Func _Browse() $savedir = FileSelectFolder("", "", 1) If @error = 1 Then Return Else GUICtrlSetData($Dirinput, $savedir & "\") EndIf EndFunc ;==>_Browse Func _DropFile() _GetFileData() If $Valid Then $hFiles[UBound($hFiles) - 1] = _GDIPlus_ImageLoadFromFile($oFiles[1]) GUICtrlCreateListViewItem($oFiles[0] & "|" & $oFiles[1] & "|" & $oFiles[2], $FileList) GUICtrlSetData($Input1, $oFiles[1]) GUICtrlSetOnEvent(-1, "_Preview") ReDim $hFiles[UBound($hFiles) + 1] EndIf EndFunc ;==>_DropFile Func _GetFileData() Local $oSplit, $iSplit, $iCount $oSplit = StringSplit(@GUI_DragFile, ".") For $i = 0 To UBound($oTypes) - 1 If StringUpper(String($oSplit[$oSplit[0]])) = $oTypes[$i] Then $Valid = 1 ExitLoop Else $Valid = 0 EndIf Next If Not $Valid Then _MsgBox(64, "Invalid File Format", "Please Drag Image file Only", $mainfrm) Return EndIf $iSplit = StringSplit($oSplit[1], "\") $iCount = UBound($iSplit, 1) - 1 If $oFiles[1] = String(@GUI_DragFile) Or _Check() Then $Valid = 0 Return EndIf $oFiles[0] = String($iSplit[$iCount]) $oFiles[1] = String(@GUI_DragFile) $oFiles[2] = Round(FileGetSize(@GUI_DragFile) / 1024, 1) & "Kb" EndFunc ;==>_GetFileData Func _MsgBox($iFlags, $sTitle, $sText, $hWnd) Local $aRet = DllCall('user32.dll', 'int', 'MessageBox', 'hwnd', $hWnd, 'str', $sText, 'str', $sTitle, 'uint', $iFlags) Return $aRet[0] EndFunc ;==>_MsgBox Func _Preview() GUICtrlDelete($Image) $readpic = GUICtrlRead($Input1) $Image = GUICtrlCreatePic($readpic, 272, 80, 257, 220) EndFunc ;==>_Preview Func _Bye() _GDIPlus_ShutDown() Exit EndFunc ;==>_Bye Func _Check() For $i = 0 To _GUICtrlListView_GetItemCount($FileList) If _GUICtrlListView_GetItemText($FileList, $i, 1) = String(@GUI_DragFile) Then Return True EndIf Next EndFunc ;==>_Check Func _Convert() If _GUICtrlListView_GetItemCount($FileList) = 0 Then Return GUICtrlSetState($Convert, $GUI_DISABLE) GUICtrlSetData($Convert, "Converting..Please Wait..") Local $Ext = _GDIPlus_EncodersGetCLSID($oTypes[_GUICtrlComboBox_GetCurSel($FileType)]) Local $iMod = 100 / _GUICtrlListView_GetItemCount($FileList) For $i = 0 To _GUICtrlListView_GetItemCount($FileList) GUICtrlSetData($Progress, $iMod * $i) _GDIPlus_ImageSaveToFileEx($hFiles[$i], $savedir & _GUICtrlListView_GetItemText($FileList, $i, 0) & "." & StringLower($oTypes[_GUICtrlComboBox_GetCurSel($FileType)]), $Ext, 0) Sleep(800) Next GUICtrlSetData($Progress, 0) GUICtrlSetState($Convert, $GUI_ENABLE) GUICtrlSetData($Convert, "Convert Images Now") EndFunc ;==>_Convert well thats all i can think of it very nice. Free icons for your programs Link to comment Share on other sites More sharing options...
John117 Posted November 26, 2007 Share Posted November 26, 2007 @GeneratorI did this while trying to fix the preview bug for you, I could'nt fix it, maybe it a bug with the latest autoit...Well Generator you may use this as you want just please give credit... NO BODY EXCEPT GENERATOR CAN USE THIS WITHOUR HIS PERMISSON AS ITS HIS SCRIPT.So are you giving him permission to use his script and demanding credit? or did you want credit for your non working version of his script? Link to comment Share on other sites More sharing options...
Generator Posted November 26, 2007 Author Share Posted November 26, 2007 (edited) For me it does not work, it says i need "GUIComboBox.au3" and "GDIPlus.au3" I already have the latest beta You need v3.2.10.0 which is released at homepage About Image Viewer see: hereFixed preview, not sure how is this related to that topic Have you an example on how to reduce the number of color and how to crop an image ? ThanksUse #Include <GDIPlus.au3> _GDIPlus_BitmapCloneArea($hBmp, $iLeft, $iTop, $iWidth, $iHeight[, $iFormat = 0x00021808])@Generator Perfect, but I am in need of an image RESIZER to schrink the size to the files. would that be possible to add ? regards, ptrexNot unless I know a way to do it. Vrey nice, soemtime when i open the converted image it cannot preview... but if i make it do 2 at any one time then thats fixed... and im not on about the prieview that you cannot get working, im taking about when it click on where i saved it.Preview Fixed, it was _GDIPlus_ImageLoadFromFile, now it works in another order and better. Edit: Problem solved. P.S: Preview only supports BMP, JPG Edited November 27, 2007 by Generator Link to comment Share on other sites More sharing options...
timgames Posted November 26, 2007 Share Posted November 26, 2007 You need v3.2.10.0 which is released at homepageThanks, now it works perfect Link to comment Share on other sites More sharing options...
smashly Posted November 26, 2007 Share Posted November 26, 2007 (edited) Hi,Nice workFor Delete you can delete a selected item in the listview with GUICtrlDelete(GUICtrlRead($FileList)) To delete all items in your listview _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($FileList))Suggestions: Add muti file drag and drop.Set the Gui to Topmost so I'm not chasing the window while dropping files. Cheers Edited November 26, 2007 by smashly Link to comment Share on other sites More sharing options...
Generator Posted November 26, 2007 Author Share Posted November 26, 2007 Hi,Nice workFor Delete you can delete a selected item in the listview with GUICtrlDelete(GUICtrlRead($FileList)) To delete all items in your listview _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($FileList))Suggestions: Add muti file drag and drop.Set the Gui to Topmost so I'm not chasing the window while dropping files. CheersThanks for the info, updated as described. Link to comment Share on other sites More sharing options...
ashley Posted November 26, 2007 Share Posted November 26, 2007 Preview bug: Png's cannot be previewed Free icons for your programs Link to comment Share on other sites More sharing options...
smashly Posted November 27, 2007 Share Posted November 27, 2007 Thanks for the info, updated as described.Sorry my bad missiformation about the DeleteAll .. After reading some of the other forum posts in regaurds to deleting all listview items I think you should be using something like While _GUICtrlListView_GetItemCount($FileList) > 0 _GUICtrlListView_SetItemSelected($FileList, 0, True) GUICtrlDelete(GUICtrlRead($FileList)) WEnd Cheers Link to comment Share on other sites More sharing options...
ashley Posted November 27, 2007 Share Posted November 27, 2007 Sorry my bad missiformation about the DeleteAll .. After reading some of the other forum posts in regaurds to deleting all listview items I think you should be using something like While _GUICtrlListView_GetItemCount($FileList) > 0 _GUICtrlListView_SetItemSelected($FileList, 0, True) GUICtrlDelete(GUICtrlRead($FileList)) WEnd Cheers agreed Free icons for your programs Link to comment Share on other sites More sharing options...
ashley Posted November 27, 2007 Share Posted November 27, 2007 i draged an icon file on to it and it says only drag image files... AN icon is file is an image??? Free icons for your programs Link to comment Share on other sites More sharing options...
smashly Posted November 27, 2007 Share Posted November 27, 2007 (edited) Thank you for the updates Seems to be working good ftm , the preview works nicely and the context remove/remove all makes it user friendly. Suggestions: Add another column called Pixels to the $FileList listview and put the Dimension of the image.. eg: WxH Add checkboxes in the the $FileList listview. This way a user can select the the files to be processed or removed by checking or unchecking the items in the list. Add the option to SelectAll/UnSelectAll. (would be handy if checkboxes idea was implemented) Add MultiDrop files and and use a filter so that only supported picture files will be added. Doing the filter part makes the msg box redundant and you can also catch dupes in the process so there not added again to the list. I find single 1 at a time adding images is slow and tedious when you want to drop 20 + pics. Add drop a folder in the save path field... Edit: Add checkbox to gui so when it's checked it opens output folder when the coversion is done I've actually added these above features already to a modified version of your script. And it really speeds up my use of the interface. I open a folder, press Ctrl + A and drag the contents of the folder into your interface. Out of 200+ files/folders dropped 65 are actual images.. Bam.. 65 images in the list with no nags.. I then select by clicking the checkboxes. I drag the output folder I want the pics saved to into the save field and hit convert.. After selected images are converted I the hit the remove and the selected images are removed I do the same process again on the images that are left because I want them in a different directory.. Sometimes I drop an archive and I realize it's the wrong archive of images .. I then Select All and hit Remove.. It's really quite functional using multi drop and checkboxes with dupe and filter checking when dropping files:) Cheers Edited November 28, 2007 by smashly Link to comment Share on other sites More sharing options...
Generator Posted November 29, 2007 Author Share Posted November 29, 2007 Updated. See first post. Link to comment Share on other sites More sharing options...
smashly Posted November 29, 2007 Share Posted November 29, 2007 Thank you for the excellent update, damn your IC is rockin' .. w00t. Nice work I worked out how to do the resize option , as well as use a small preview using gdi instead of ie.. Which means icon previewing works, with just about any other format for previewing. In the mean time I've dropped the copression/quality/dpi settings till I tidy up the resize functions a bit more .. But I added some other trivial options instead Will post the updates shortly... Between both our scripts and other user input you'll end up making a full blown imaging tool in autoit. Hmm, I think I'm getting ahead myself again.. lol Cheers 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