ProgAndy Posted May 20, 2009 Share Posted May 20, 2009 (edited) I am proud to announce an UDF collection for FreeImage.The Library contains all functions of the 3.15.0.0-release (the documentaition is located here (PDF) )If you need more informatin about the functions, you have to read the PDF since i did not include comments in the AU3-file.If you want to download it, click here: [uDF] FreeImage library Downloads:And now an example for resizing an image (it saves the resized image in a new file, e.g. image.png will be saved as image_rsz.png)#include <FreeImage.au3> _FreeImage_LoadDLL(@ScriptDir&"\FreeImage.dll") _FreeImage_Initialise() $sFile = "800x600.jpg" ; new sizes $width = 400 $height = 300 $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $hImage = _FreeImage_LoadU($FIF, $sFile) $hImageResized = _FreeImage_Rescale($hImage, $width, $height, $FILTER_LANCZOS3) $dot = StringInStr($sFile,".",1,-1) $Name = StringLeft($sFile,$dot-1) $Ext = StringMid($sFile,$dot) _FreeImage_SaveU($FIF, $hImageResized, $Name &"_rsz"&$Ext) _FreeImage_Unload($hImage) _FreeImage_Unload($hImageResized) _FreeImage_DeInitialise()</div>And an other example for Flip and Rotate:expandcollapse popup#include <FreeImage.au3> Global $ImageHandle=-1, $WorkingFileName, $FIF _FreeImage_LoadDLL(@ScriptDir&"\FreeImage.dll") _FreeImage_Initialise() Func OnAutoItExit() If $ImageHandle <>-1 Then _FreeImage_Unload($ImageHandle) _FreeImage_DeInitialise() EndFunc GUICreate("FreeImage Test GUI",800,700) $ShowPic = GUICtrlCreatePic("",0,0, 800,600) $btnOpen = GUICtrlCreateButton("Choose File", 10, 610, 100, 30) GUICtrlSetTip(-1,"Only a copy of the image will be used") $btnFlipH = GUICtrlCreateButton("Flip Horizontal", 120, 610, 100, 30) $btnFlipV = GUICtrlCreateButton("Flip Vertical", 230, 610, 100, 30) $btnRotate = GUICtrlCreateButton("Rotate ...", 340, 610, 100, 30) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $btnOpen _OpenImage() Case $btnFlipH If $ImageHandle <> -1 Then _FreeImage_FlipHorizontal($ImageHandle) _FreeImage_SaveU($FIF, $ImageHandle, $WorkingFileName) _ShowImage() EndIf Case $btnFlipV If $ImageHandle <> -1 Then _FreeImage_FlipVertical($ImageHandle) _FreeImage_SaveU($FIF, $ImageHandle, $WorkingFileName) _ShowImage() EndIf Case $btnRotate If $ImageHandle <> -1 Then $hImageNew = _FreeImage_RotateClassic($ImageHandle, Number(InputBox("Rotate", "angle for rotation", 90))) _FreeImage_SaveU($FIF, $hImageNew, $WorkingFileName) _FreeImage_Unload($ImageHandle) $ImageHandle = $hImageNew _ShowImage() EndIf EndSwitch WEnd Func _OpenImage() Local $sFile = FileOpenDialog("Choose Image","", "Image Files (*.jpg;*.jpeg;*.bmp;*.gif)", 3) If @error Then Return If $ImageHandle <> -1 Then _FreeImage_Unload($ImageHandle) Local $dot = StringInStr($sFile,".",1,-1) Local $Name = StringLeft($sFile,$dot-1) Local $Ext = StringMid($sFile,$dot) $WorkingFileName = $Name &"_FI4AU3"&$Ext FileCopy($sFile,$WorkingFileName) $FIF = _FreeImage_GetFileTypeU($WorkingFileName) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($WorkingFileName) EndIf $ImageHandle = _FreeImage_LoadU($FIF, $sFile) _ShowImage() EndFunc Func _ShowImage() Local $Width, $Height _SizeProportional($Width, $Height, 800, 600, _FreeImage_GetWidth($ImageHandle), _FreeImage_GetHeight($ImageHandle)) GUICtrlSetPos($ShowPic,0,0,$Width, $Height) GUICtrlSetImage($ShowPic, $WorkingFileName) EndFunc Func _SizeProportional(ByRef $Width, ByRef $Height, $WDesired, $HDesired, $WSrc, $HSrc) ; Prog@ndy Local $RatioDes = ($WDesired / $HDesired) Local $CurrentRatio = ($WSrc / $HSrc) If $CurrentRatio > $RatioDes Then ; scale height $Width = $WDesired $Height = $WDesired / $CurrentRatio Else ; scale width $Width = $HDesired * $CurrentRatio $Height = $HDesired EndIf EndFunc ;==>_SizeProportional Edited May 3, 2011 by ProgAndy mLipok and yutijang 1 1 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
FireFox Posted May 20, 2009 Share Posted May 20, 2009 @ProgAndy Good stuff PS : undeclared variable error : $pDIB Cheers, FireFox. Link to comment Share on other sites More sharing options...
ProgAndy Posted May 20, 2009 Author Share Posted May 20, 2009 Corrected... forgot to rename it. That happens when you copy / paste functions 40 times in a row... *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
ProgAndy Posted May 23, 2009 Author Share Posted May 23, 2009 (edited) 74 downloads and only one comment? Do you like it or not? Edited May 23, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
trancexx Posted May 23, 2009 Share Posted May 23, 2009 (edited) I tried to download, the other day, for about dozen times and failed every time. edit: It's happening again. I just can't download. It starts and then DL slows down to 0 after few seconds. Edited May 23, 2009 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Valuater Posted May 23, 2009 Share Posted May 23, 2009 74 downloads and only one comment? Do you like it or not?We all get this with lots of lookie-loos around here. I used your demo and it worked fine. However, when I read some of the abilities of the dll, like rotations and etc, I thought maybe you should have given a better demo that displayed some of the capabilities of your UDF.Nice job overall, just don't understand all the applications.8) Link to comment Share on other sites More sharing options...
Valuater Posted May 23, 2009 Share Posted May 23, 2009 (edited) I tried to download, the other day, for about dozen times and failed every time. I just downloaded it again and it worked fine. 1st click the download here ( above )2nd click download at his site3rd You have to check the checkbox that you agree to the terms of use....4th click the download button at his site5th... wait for it.... and whala!!! .... it'sdownloading8) Edited May 23, 2009 by Valuater Link to comment Share on other sites More sharing options...
trancexx Posted May 23, 2009 Share Posted May 23, 2009 I just downloaded it again and it worked fine. 1st click the download here ( above )2nd click download at his site3rd You have to check the checkbox that you agree to the terms of use....4th click the download button at his site5th... wait for it.... and whala!!! .... it'sdownloading8)Yes, I've gone thru elementary school. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
ProgAndy Posted May 23, 2009 Author Share Posted May 23, 2009 (edited) I used your demo and it worked fine. However, when I read some of the abilities of the dll, like rotations and etc, I thought maybe you should have given a better demo that displayed some of the capabilities of your UDF.Yeah, i didn't have time to write a good example. I'm thinking about a GUI with some Buttons @trancexx: I'll send you a PN with the Library. I'm sorry, but i doN#t know the reason why it is not working for you. Edited May 23, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Valuater Posted May 23, 2009 Share Posted May 23, 2009 Yes, I've gone thru elementary school.Your Welcome8) Link to comment Share on other sites More sharing options...
trancexx Posted May 23, 2009 Share Posted May 23, 2009 No, seriously. I can't download. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
ProgAndy Posted May 23, 2009 Author Share Posted May 23, 2009 (edited) New example in first Post. Dont' forget to download the fixed UDFs Edited May 23, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Valuater Posted May 23, 2009 Share Posted May 23, 2009 New example in first Post. Dont' forget to download the fixed UDFs Much Nicer Andy!!8) Link to comment Share on other sites More sharing options...
Yashied Posted May 23, 2009 Share Posted May 23, 2009 ProgAndy, 5 stars that I have promised. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 23, 2009 Moderators Share Posted May 23, 2009 Nice work Progandy... certainly is a hog on the cpu during the calling sequences though. 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...
Datenshi Posted May 23, 2009 Share Posted May 23, 2009 (edited) Good work man, was actually thinking of a similar UDF a couple of weeks ago but never got to it Edited May 23, 2009 by Datenshi RapidQueuer 2.4 - For Rapidshare.comOpensubtitles Hashing FuncRevision3 PlayerGTPlayer BetaIMDB & Poster Grabber v1.3Fetgrek.com - My Website Link to comment Share on other sites More sharing options...
trancexx Posted May 24, 2009 Share Posted May 24, 2009 Huge and nice work ProgAndy (as always ). ...so, imagine the size of the heads of creators of FreeImage.dll. One more thing. I see this thread is rated 3 and three peoples voted. Yashied gave 5. So, other two forum members rated it with 4 or 3 (together!!!). Either sick or by accident. In any case - stupid. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Yashied Posted May 24, 2009 Share Posted May 24, 2009 I believe that ProgAndy has done the hard work, and the result of the work exceeded all my expectations. This is definitely 5+. If someone does not understand how to use a library or do not want to understand, this is not the reason for the reduction of rating. This is not an objective opinion. This UDF will facilitate the work with images to many people. If you look at the counter, then the library has been downloaded 108 times during the 4 days. This speaks to the interest of people to this work. I do not understand what reasons people rated it at 3* or 4*. Maybe they will tell us about it? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
ProgAndy Posted May 24, 2009 Author Share Posted May 24, 2009 ProgAndy, 5 stars that I have promised.Nice work Progandy... certainly is a hog on the cpu during the calling sequences though.Good work man, was actually thinking of a similar UDF a couple of weeks ago but never got to it Huge and nice work ProgAndy (as always ).Thank you all *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
ptrex Posted June 7, 2009 Share Posted June 7, 2009 @ProgAndyNice work as usual.If some feels better off with the COM version, you can download the wrapper here.Including the Help file and Example application.PhotoTrue 2.4 VB6 build© 2000-2006 David Crowellhttp://davidcrowell.com/phototrueRoyalty-free distributionINTRODUCTIONPhotoTrue is an ActiveX DLL that allows manipulation of true-color (continuous tone) images. PhotoTrue allows reading and writing to JPG and BMP formats. PhotoTrue is an inexpensive component, perfect for use in image processing tools. PhotoTrue is also easy to deploy, andis quite small.Regardsptrex 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...
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