Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

FreeImage Library


  • Please log in to reply
62 replies to this topic

#1 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 20 May 2009 - 04:52 PM

Posted Image
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:Posted Image

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)
[codebox]
Plain Text         
#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:
AutoIt         
#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 by ProgAndy, 03 May 2011 - 04:11 PM.

*GERMAN* Posted Image [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







#2 FireFox

FireFox

    It slips through our fingers, like a fist full of sand.

  • MVPs
  • 5,381 posts

Posted 20 May 2009 - 05:45 PM

@ProgAndy
Good stuff :)

PS : undeclared variable error : $pDIB

Cheers, FireFox.

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.

Hardware : Intel® Core™ i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !


#3 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 20 May 2009 - 05:54 PM

Corrected... forgot to rename it. That happens when you copy / paste functions 40 times in a row...
*GERMAN* Posted Image [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

#4 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 23 May 2009 - 05:42 PM

74 downloads and only one comment? Do you like it or not?

Edited by ProgAndy, 23 May 2009 - 05:43 PM.

*GERMAN* Posted Image [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

#5 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,246 posts

Posted 23 May 2009 - 05:47 PM

I tried to download, the other day, for about dozen times and failed every time. :party:

edit: It's happening again. I just can't download. It starts and then DL slows down to 0 after few seconds. :)

Edited by trancexx, 23 May 2009 - 05:58 PM.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#6 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 23 May 2009 - 05:52 PM

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)

Posted Image

Clic The Pic!!!


#7 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 23 May 2009 - 05:56 PM

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 site

3rd You have to check the checkbox that you agree to the terms of use....

4th click the download button at his site

5th... wait for it.... and whala!!! .... it'sdownloading


8)

Edited by Valuater, 23 May 2009 - 05:57 PM.

Posted Image

Clic The Pic!!!


#8 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,246 posts

Posted 23 May 2009 - 05:59 PM

I just downloaded it again and it worked fine.

1st click the download here ( above )

2nd click download at his site

3rd You have to check the checkbox that you agree to the terms of use....

4th click the download button at his site

5th... wait for it.... and whala!!! .... it'sdownloading


8)

Yes, I've gone thru elementary school.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#9 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 23 May 2009 - 06:05 PM

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 by ProgAndy, 23 May 2009 - 06:07 PM.

*GERMAN* Posted Image [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

#10 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 23 May 2009 - 06:05 PM

Yes, I've gone thru elementary school.


Your Welcome

8)

Posted Image

Clic The Pic!!!


#11 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,246 posts

Posted 23 May 2009 - 06:08 PM

No, seriously. I can't download.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#12 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 23 May 2009 - 06:47 PM

New example in first Post. Dont' forget to download the fixed UDFs :)

Edited by ProgAndy, 23 May 2009 - 06:48 PM.

*GERMAN* Posted Image [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

#13 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 23 May 2009 - 07:10 PM

New example in first Post. Dont' forget to download the fixed UDFs :)



Much Nicer Andy!!

8)

Posted Image

Clic The Pic!!!


#14 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,574 posts

Posted 23 May 2009 - 07:19 PM

ProgAndy, 5 stars that I have promised.

:)

#15 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,730 posts

Posted 23 May 2009 - 07:44 PM

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.


#16 Datenshi

Datenshi

    Prodigy

  • Active Members
  • PipPipPip
  • 179 posts

Posted 23 May 2009 - 09:04 PM

Good work man, was actually thinking of a similar UDF a couple of weeks ago but never got to it :)

Edited by Datenshi, 23 May 2009 - 09:04 PM.


#17 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,246 posts

Posted 24 May 2009 - 12:10 PM

Huge and nice work ProgAndy (as always :party: ).

...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.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#18 Yashied

Yashied

    Happy in Moscow

  • MVPs
  • 2,574 posts

Posted 24 May 2009 - 12:41 PM

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?

Posted Image

#19 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 24 May 2009 - 04:11 PM

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 :idea: ).

Thank you all :party:
*GERMAN* Posted Image [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

#20 ptrex

ptrex

    Universalist

  • MVPs
  • 2,420 posts

Posted 07 June 2009 - 06:59 PM

@ProgAndy

Nice 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 Crowell
http://davidcrowell.com/phototrue
Royalty-free distribution


INTRODUCTION
PhotoTrue 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, and
is quite small.


Regards

ptrex




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users