Jump to content
Sign in to follow this  
ProgAndy

FreeImage Library

Recommended Posts

Such a great work!

For those people who experiment with FreeImage UDF function

are the best view the image at window form instead save to file

and view on Image Viewer. That pain in the ass.

http://freeimage.sourceforge.net/faq.html

View with this method!

Your Template.

#include <WinAPI.au3>
#include <FreeImage.au3>
#include <Windows.au3>

$DLL_GDI32 = DllOpen('Gdi32.dll')

_FreeImage_LoadDLL()

$pDIB = _FreeImage_Load($FIF_JPEG, 'normal.jpg',$JPEG_DEFAULT)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 623, 442, -1, -1)
$Pic1 = GUICtrlCreatePic("", 8, 8, 217, 41)

GUISetState(@SW_SHOW)

$hDC = _WinAPI_GetDC(GUICtrlGetHandle($Pic1))
$l = _WinGDI_SetStretchBltMode($hDC, $COLORONCOLOR)

$n = _WinGDI_StretchDIBits($hDC, 0, 0, 217, 41, _
    0, 0, _FreeImage_GetWidth($pDIB), _FreeImage_GetHeight($pDIB), _
    _FreeImage_GetBits($pDIB), _FreeImage_GetInfo($pDIB), $DIB_RGB_COLORS, $SRCCOPY);

_FreeImage_Unload($pDIB)

Do
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
Until False

Func _WinGDI_SetStretchBltMode($hDC, $StretchMode)
   Local $ret
   $ret = DllCall($DLL_GDI32, 'int', 'SetStretchBltMode', 'handle', $hDC, 'int', $StretchMode)
   If @error Or $ret[0] Then Return SetError(1, @extended, 0)
   Return $ret[0]
EndFunc

Func _WinGDI_StretchDIBits($hdc, $XDest, $YDest, $DestWidth, $DestHeight, $XSrc, $YSrc, $SrcWidth, $SrcHeight, $Bits, $BitsInfo, $Usage, $Rop)
   Local $ret
   $ret = DllCall($DLL_GDI32, 'int', 'StretchDIBits', 'handle', $hDC, 'int', $XDest, 'int', $YDest, 'int', $DestWidth, 'int', $DestHeight, 'int', $XSrc, 'int', $YSrc, 'int', $SrcWidth, 'int', $SrcHeight, 'ptr', $Bits, 'ptr', $BitsInfo, 'uint', $Usage, 'dword', $Rop)
   If @error Or $ret[0] Then Return SetError(1, @extended, 0)
   Return $ret[0]
EndFunc

Windows.au3

#include-once

; DIB color table identifiers
Global Const $DIB_RGB_COLORS  = 0    ; color table in RGBTriples
Global Const $DIB_PAL_COLORS  = 1    ; color table in palette indices

; StretchBlt modes
Global Const $BLACKONWHITE    = 1
Global Const $WHITEONBLACK    = 2
Global Const $COLORONCOLOR    = 3

; New StretchBlt modes
Global Const $STRETCH_ANDSCANS    = 1
Global Const $STRETCH_ORSCANS     = 2
Global Const $STRETCH_DELETESCANS = 3

For those who download FreeImage UDF and always failed!

Yes its true ProgAndy download Site's doesn't support Accept-Ranges: bytes instead of Accept-Ranges: */*

So I'm using my site as leecher and save on that.

Here mirror: http://seagea.com/dload/freeimage.zip

Here are the leecher script on php for people who interested.

<?php
    $url  = 'http://progandy.de/downloads/finish/3-autoit-udfs/7-freeimage-library/0.html';
    $path = 'freeimage.zip';
 
    $fp = fopen($path, 'w');
 
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_FILE, $fp);
 
    $data = curl_exec($ch);
 
    curl_close($ch);
    fclose($fp);
?>

Search at Sam Google for FreeImage x64 and I found here.

FreeImage.dll x64 bit version

FreeImageX64.zip - code.google.com

FreeImageX64.zip - sambeauvois.be

Article

FreeImage and x64 yes You can

Edited by prazetto

# Button. Progressbar - Graphical AutoIt3 Control (UDF) # GTK on AutoIt3 - GTK+ Framework | Widgets

Share this post


Link to post
Share on other sites

I certainly am interested, do post away - used to hack a lot about with http://pngquant.org/ so be interested to see what freeimage can (not?) do when compared!

 

Oh Sunaj,

i haven't looked at the thread anymore. SORRY! If you are still interested i will dig back into the project and post some lines... :oops:

So here is the au3. Just extract what you need

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=convert.ico
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;
; Test Skript.
; Lädt ein Bild. Dreht es um einen fest vordefinierten Winkel und staucht es dann um PI/4. Danach wird es mit einem anderen Namen gespeichert.
;

#include <File.au3>

#include <Freeimage\FreeImage.au3>

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("Convert into isometric view...", 556, 438, 252, 183)
GUISetBkColor(0xFFFFFF)
$ButtonPathchange = GUICtrlCreateButton("...", 453, 29, 41, 25)
$LabelPath = GUICtrlCreateLabel("Pfad:", 24, 32, 29, 17)
$InputPath = GUICtrlCreateInput("", 56, 30, 385, 21)
$ButtonStartConvert = GUICtrlCreateButton("Konvertierung starten", 184, 64, 193, 41)
$ProtocolField = GUICtrlCreateEdit("", 32, 128, 497, 289)
GUICtrlSetData(-1, "ProtocolField")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

FileInstall("Freeimage\FreeImage.dll", @TempDir & "\",1)

Local $sTempPath

; Protokollfeld löschen
GUICtrlSetData($ProtocolField, "", "")

; Pfad setzen
GUICtrlSetData( $InputPath, @ScriptDir)

_FreeImage_LoadDLL(@TempDir & "\FreeImage.dll")
_FreeImage_Initialise()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $ButtonPathchange
                $sTempPath = FileSelectFolder("Convert. QuellPfad auswählen.", "", 0, GUICtrlRead($InputPath))
                If $sTempPath <> "" Then
                    GUICtrlSetData( $InputPath, $sTempPath)
                    _PrintLog("Quellpfad geändert: " & $sTempPath & @CRLF)
                EndIf

        Case $ButtonStartConvert
                _ConvertStart(GUICtrlRead($InputPath))

        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

    _FreeImage_DeInitialise()

Exit



;~ _ConvertPicture(".\Images\TestImage.jpg")


Func _ConvertStart($sFolder)

    Local $iResult
    Local $iCounter
    Local $sDummy
    Local $aPathSplit

    _PrintLog(@CRLF)
    _PrintLog("=====================================================================" & @CRLF)
    _PrintLog("                           STARTE KONVERTIERUNG" & @CRLF)
    _PrintLog(@CRLF)


    ; exisitert der nötige Unterordner "ISO" ?
    If Not FileExists($sFolder & "\ISO") Then
        $iResult = DirCreate($sFolder & "\ISO")
        If $iResult = 0 Then

            _PrintLog("Konnte Unterordner 'ISO' nicht erstellen." & @CRLF)
            _PrintLog("Verarbeitung wird abgebrochen." & @CRLF)
            _PrintLog("=====================================================================" & @CRLF)
            Return
        EndIf
    EndIf

    ; Dateiliste erstellen und jede Datei die noch nicht konvertiert wurde bearbeiten

    Local $aSourceFileList = _FileListToArray($sFolder, "*.*", 1)
    Local $aDestinationFileList = _FileListToArray($sFolder & "\ISO", "*.*", 1)

    If Not IsArray($aSourceFileList) Then
        _PrintLog(@CRLF & "Keine Dateien gefunden." & @CRLF)
        Return
    EndIf


    For $iCounter = 1 To $aSourceFileList[0]
        ; reinen Dateinamen ohne Dateityperweiterung extrahieren
         $aPathSplit = _PathSplit($aSourceFileList[$iCounter], $sDummy, $sDummy, $sDummy, $sDummy)


        If Not FileExists($sFolder & "\ISO\" & $aPathSplit[3] & ".png") And (StringInStr(".bmp.jpg.png", $aPathSplit[4]) > 0) Then
            _PrintLog("konvertiere: " & $aSourceFileList[$iCounter] & "  ..." )
            _ConvertPicture($sFolder & "\" & $aSourceFileList[$iCounter], $sFolder & "\ISO\" & $aPathSplit[3] & ".png")
            _PrintLog("  OKAY" & @CRLF)
        EndIf

    Next

    _PrintLog(@CRLF)
    _PrintLog("                        KONVERTIERUNG BEENDET" & @CRLF)
    _PrintLog("=====================================================================" & @CRLF)
    _PrintLog(@CRLF)

EndFunc



Func _ConvertPicture($sSourceFilename, $sDestinationFilename)

Local $fDegree = 30
Local $fCompress = 0.78539816339744830961566084581988  ; PI / 4
Local $fCompress = 0.6
Local $structBkColor = DllStructCreate("byte;byte;byte")
Local $pBkColor = DllStructGetPtr($structBkColor)
Local $iCounter


ConsoleWrite(@ScriptDir & "   " & @ScriptName & @CRLF)

; Drehwinkel und Stauchungsfaktor aus möglicher INI auslesen
If FileExists(StringTrimRight(@ScriptName,4) & ".ini") Then
    $fDegree = IniRead(@ScriptDir & "\" & StringTrimRight(@ScriptName,4) & ".ini", "UserSettings", "Drehwinkel", $fDegree)
    $fCompress = IniRead(@ScriptDir & "\" & StringTrimRight(@ScriptName,4) & ".ini", "UserSettings", "Stauchungsfaktor", $fCompress)
EndIf




; Setze Farbwert auf weiß. Damit der Hintergrund im Drehvorgang weiß und nicht schwarz wird.
DllStructSetData($structBkColor, 1, 255)
DllStructSetData($structBkColor, 2, 255)
DllStructSetData($structBkColor, 3, 255)

$sSourceFilenameExt = StringRight($sSourceFilename, 4)
$sSourceFilename = StringTrimRight($sSourceFilename, 4)


; Öffne das Bild
Local $FIF = _FreeImage_GetFileTypeU($sSourceFilename & $sSourceFilenameExt)
If $FIF = $FIF_UNKNOWN Then
    $FIF = _FreeImage_GetFIFFromFilenameU($sSourceFilename & $sSourceFilenameExt)
EndIf
$hImage = _FreeImage_LoadU($FIF, $sSourceFilename & $sSourceFilenameExt)
ConsoleWrite("$hImage: " & $hImage & @CRLF)

; Bild drehen
Local $hImageRotated = _FreeImage_Rotate($hImage, $fDegree, $pBkColor)

; Bild stauchen
Local $iHeight = _FreeImage_GetHeight($hImageRotated)
Local $iNewHeight = Int($iHeight*$fCompress)
ConsoleWrite("Size to rescale to: " & $iNewHeight & " x " & _FreeImage_GetWidth($hImageRotated) & @CRLF)
$hImageScaled = _FreeImage_Rescale($hImageRotated, _FreeImage_GetWidth($hImageRotated), $iNewHeight, $FILTER_BILINEAR)

; FarbTyp ermitteln
Local $iResult = _FreeImage_GetBPP($hImage)
ConsoleWrite("Bits per Pixel: " & $iResult & @CRLF)

; konvertiere das Bild in ein 8Bit Bitmap. Somit können wir dann weiß als Transparenzfarbe setzen
Local $hQuantImage = _FreeImage_ColorQuantize($hImageScaled, $FIQ_NNQUANT);
ConsoleWrite("Quantize result: " & $hQuantImage & @CRLF)


; Palette abfragen und Farbe Weiß suchen
Local $pPalette = _FreeImage_GetPalette($hQuantImage)
ConsoleWrite("pPalette: " & $pPalette & @CRLF)

Local $tagPaletteComplete = "align 1"
For $iCounter = 1 To 256
    $tagPaletteComplete = $tagPaletteComplete & ";BYTE[4]"
Next
Local $structPalette = DllStructCreate($tagPaletteComplete, $pPalette)
;~ Local $structPalette = DllStructCreate("align 1;BYTE[1024]", $pPalette)

Local $tagTransparency = "align 1"
For $iCounter = 1 to 256
    $tagTransparency = $tagTransparency & ";BYTE"
Next
;~ Local $structTransparency = DllStructCreate($tagTransparency)
Local $structTransparency = DllStructCreate("align 1; BYTE[256]")

For $iCounter = 1 To 256
    DllStructSetData($structTransparency, 1, 0xFF, $iCounter)
;~  ConsoleWrite("Palettevalues " & $iCounter & ": " & DllStructGetData($structPalette,$iCounter,1) & " " & DllStructGetData($structPalette,$iCounter,2) & " " & DllStructGetData($structPalette,$iCounter,3) & @CRLF)
    If (DllStructGetData($structPalette,$iCounter,1) >= 240) And _
        (DllStructGetData($structPalette,$iCounter,2) >= 240) And _
        (DllStructGetData($structPalette,$iCounter,3) >= 240) Then
        ;weiße Farbe in der Palette gefunden
        DllStructSetData($structTransparency, 1, 0x00, $iCounter)
;~      ConsoleWrite("~weiße Farbe in der Palette gefunden" & @CRLF)
    EndIf
Next

; Transparenztabelle setzen
$iResult = _FreeImage_SetTransparencyTable($hQuantImage, DllStructGetPtr($structTransparency), 256);


; Pfad aus Dateinamen extrahieren und den Unterordner ISO einfügen.
;~ Local $aPathSplit = _PathSplit($sFilename & $sFilenameExt, $sDummy, $sDummy, $sDummy, $sDummy)

;~ Local $sFilename = $aPathSplit[1] & $aPathSplit[2] & "ISO\" & $aPathSplit[3] & $aPathSplit[4]


; Bild abspeichern
_FreeImage_Save($FIF_PNG, $hQuantImage, $sDestinationFilename)


If $hImage <>-1 Then _FreeImage_Unload($hImage)
    If $hImageRotated <>-1 Then _FreeImage_Unload($hImageRotated)
    If $hImageScaled <>-1 Then _FreeImage_Unload($hImageScaled)

EndFunc




Func _PrintLog($sLog)
    GUICtrlSetData($ProtocolField, $sLog, ".")

EndFunc

Func OnAutoItExit()
    FileDelete(@TempDir & "\FreeImage.dll")
EndFunc
Edited by Sundance

Share this post


Link to post
Share on other sites

Do you always have to load the image from a file when you want to convert it to an FBITMAP? Is there a faster way to convert an image in memory to an FBITMAP? Like GDIplus has "GDIPlus_BitmapCreateFromHBITMAP

Edited by opalem

Share this post


Link to post
Share on other sites

Is this thread still alive?

I downloaded the UDF, but the code line "If @AutoItX64 Then Exit" right near the top prohibits its use in 64-bit code.

I've read that the FreeImage library can be re-built for a 64-bit target (see: FreeImage and x64 projects : Yes you can ! )  Would that be enough to allow it's use with 64-bit AutoIt and under 64-bit Windows? Or would there have to be changes made to @ProgAndy's UDF as well?

Thanks!

Share this post


Link to post
Share on other sites

You can use my port FreeImage UDF to both x64/x86 - its working with latest v3.17.0.0 DLLs.

default names for dlls:

"FreeImage_x64.dll"
"FreeImage_x86.dll"

 

 

Edited by Iczer
deleted old UDF version, updated version in post #67

Share this post


Link to post
Share on other sites

Thanks, @Iczer !

Sorry for the delay, but I'm just now getting back to trying to finish my app that would use this UDF.  It's great that your mods work with the 3.17 DLLs, but the code in your modified UDF appears to not have been totally updated for the 3.17 release. For example, it's missing a wrapper for FreeImage_GetMemorySize(), but I don't yet know if there are any other issues...

An extremely trivial issue is that although _FreeImage_GetVersion() returns the correct info, internal to the au3 file, the global constant $FREEIMAGE_MINOR_VERSION is still set to 15.

I'm willing to try to update the UDF you posted above to address these issues, but I'm too much of a newb to trust myself to do this correctly, so I would greatly appreciate your assistance.

Thanks!

Share this post


Link to post
Share on other sites

Here  FreeImage_GetMemorySize() function (its only for 3.17+ versions - 3.15. dont have it - see FreeImage3170.pdf)

to update dll-version info on-the-fly some corrections to UDF  are needed (also updated version of UDF uploaded):

Global $FREEIMAGE_MAJOR_VERSION = 0
Global $FREEIMAGE_MINOR_VERSION = 0
Global $FREEIMAGE_RELEASE_SERIAL = 0

;------------------------------------------------------------------------------------------
Func _FreeImage_GetVersion()
    ;Author: Prog@ndy
    Local $result = DllCall($__g_hFREEIMAGEDLL, "str", (($b___FeeImageIsx64)?("FreeImage_GetVersion"):("_FreeImage_GetVersion@0")))
    If @error Then Return SetError(1, @error, "")

    Local $aVersion = StringRegExp($result[0],"(\d+)",3)
    If @error Then Return SetError(1, @error, "")

    $FREEIMAGE_MAJOR_VERSION = $aVersion[0]
    $FREEIMAGE_MINOR_VERSION = $aVersion[1]
    $FREEIMAGE_RELEASE_SERIAL = $aVersion[2]

    Return $result[0]
EndFunc   ;==>_FreeImage_GetVersion
;------------------------------------------------------------------------------------------
;~      DLL_API unsigned DLL_CALLCONV FreeImage_GetMemorySize(FIBITMAP *dib);
Func _FreeImage_GetMemorySize($pDIB)
    ;Author: Prog@ndy
    Local $result = DllCall($__g_hFREEIMAGEDLL, "uint", (($b___FeeImageIsx64)?("FreeImage_GetMemorySize"):("_FreeImage_GetMemorySize@4")), $lpFIBITMAP, $pDIB)
    If @error Then Return SetError(1, @error, 0)
    Return $result[0]
EndFunc   ;==>_FreeImage_GetMemorySize
;------------------------------------------------------------------------------------------

 

 

FreeImage_x86x64.au3

Edited by Iczer
forgot to update FreeImage_GetVersion function

Share this post


Link to post
Share on other sites

I have downloaded freeimage.zip dated 2011-05-03 and extracted freeimage.au3.

When I syntax-check it in SciTe, I get

>Running AU3Check (3.3.15.0)  from:F:\Program Files\AutoIt3\Beta  input:F:\AutoIt scripts\Annotate Pictures\FreeImage.au3
"F:\AutoIt scripts\Annotate Pictures\FreeImage.au3"(186,26) : error: $tagBITMAPINFOHEADER previously declared as a 'Const'.
        "DWORD biClrImportant;"

Where am I wrong?


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites
10 hours ago, c.haslam said:

I have downloaded freeimage.zip dated 2011-05-03 and extracted freeimage.au3.

When I syntax-check it in SciTe, I get

>Running AU3Check (3.3.15.0)  from:F:\Program Files\AutoIt3\Beta  input:F:\AutoIt scripts\Annotate Pictures\FreeImage.au3
"F:\AutoIt scripts\Annotate Pictures\FreeImage.au3"(186,26) : error: $tagBITMAPINFOHEADER previously declared as a 'Const'.
        "DWORD biClrImportant;"

Where am I wrong?

This was happening to me too. I fixed it but downloading the latest dll and the latest UDF as indicated by Iczer. Using Windows 7 here and got it to work normally after that.

Share this post


Link to post
Share on other sites

Many thanks. The download from Post 67 passes Au3Check.


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites

I am trying to get the date a picture was taken from a .jpg.

Here is my code:

#include "FreeImage_x86x64.au3"

_FreeImage_LoadDLL(@ScriptDir & "\FreeImage.dll")
_FreeImage_Initialise()

Local $fs = 'H:\temp\AP test data\P8220006.JPG'
Local $dib = _FreeImage_Load($FIF_JPEG,$fs)
Local $key = "DateTimeOriginal"
Local $pTag = _FreeImage_CreateTag()
_FreeImage_GetMetadata($FIMD_EXIF_EXIF, $dib, $key, $pTag)
Local $t =  _FreeImage_GetTagValue($pTag)
;~ Local $t =  _FreeImage_GetTagDescription($pTag)  ; works!
MsgBox(0,@ScriptLineNumber,@error)
MsgBox(0,$key,$t)

FreeImage_GetTagDescription() works OK but FreeImage_GetValue() returns a pointer, i.e. MsgBox() shows 0x...

So it appears that I need to get the string that the pointer points to.

How do I do this?


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites

I have managed to wrap Free_Image_GetValue() so that the wrapper returns the type appropriate to the data:

#include <MsgBoxConstants.au3>
#include "FreeImage_x86x64.au3"
; Ref: https://sourceforge.net/p/freeimage/discussion/36109/thread/b1464b0d/
;       https://sourceforge.net/projects/freeimage/?source=typ_redirect
;       http://web.archive.org/web/20131018091152/http://exif.org/Exif2-2.PDF pages 24-25


_FreeImage_LoadDLL(@ScriptDir & "\FreeImage.dll")
_FreeImage_Initialise()

Local $fs = 'H:\temp\AP test data\P8220006.JPG'
Local $dib = _FreeImage_Load($FIF_JPEG,$fs)
Local $pTag = _FreeImage_CreateTag()
Local $key = 'DateTimeOriginal'
_FreeImage_GetMetadata($FIMD_EXIF_EXIF, $dib, $key, $pTag)
Local $t =_FreeImage_GetTagValueEx($pTag)
If Not @error Then
    If IsArray($t) Then
        MsgBox(0,'',$key&':  '&$t[0]&','&$t[1])
    Else
        MsgBox(0,'',$key&':  '&$t)
    EndIf
Else
    MsgBox($MB_ICONERROR,'',$key&':  @error='&@error)
EndIf

Func _FreeImage_GetTagValueEx($pTag)
Local $retType
    Local $type = _FreeImage_GetTagType($pTag)
    Switch $type
        Case $FIDT_NOTYPE
            Return SetError(-1,'')
            Return ''
        Case $FIDT_BYTE,$FIDT_SBYTE,$FIDT_UNDEFINED
            $retType = 'byte'
        Case $FIDT_ASCII
            $retType = 'str'
        Case $FIDT_SHORT,$FIDT_SSHORT
            $retType = 'word'
        Case $FIDT_LONG,$FIDT_SLONG,$FIDT_IFD,$FIDT_PALETTE
            $retType = 'dword'
        Case $FIDT_RATIONAL,$FIDT_SRATIONAL
            $retType = 'uint64'
        Case $FIDT_FLOAT
            $retType = 'float'
        Case $FIDT_DOUBLE
            $retType = 'double'
    EndSwitch
    Local $result = DllCall($__g_hFREEIMAGEDLL, $retType, _
        (($b___FeeImageIsx64)?("FreeImage_GetTagValue"):("_FreeImage_GetTagValue@4")), "ptr", $pTag)
    If @error Then Return SetError(-2, '')
    If $type=$FIDT_RATIONAL Or $type=$FIDT_SRATIONAL Then
        Local $retsAr = [BitShift($result[0],16),BitAND($result[0],0xFFFF)]
        Return $retsAr
    Else
        Return $result[0]
    EndIf
EndFunc

This works for DateTimeOriginal but not for some other keys. For some keys, the $type is $FIDT_NOTYPE!

I have been using Irfanview to try to understand some of the values.

I hope this script helps others.


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites

Any clues on getting FreeImage to report errors?

I see

;~ DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf);
Func _FreeImage_SetOutputMessageStdCall($FreeImage_OutputMessageFunctionStdCall)
    ;Author: Prog@ndy
    DllCall($__g_hFREEIMAGEDLL, "none", (($b___FeeImageIsx64)?("FreeImage_SetOutputMessageStdCall"):("_FreeImage_SetOutputMessageStdCall@4")), "ptr", $FreeImage_OutputMessageFunctionStdCall)
    If @error Then Return SetError(1, @error)
EndFunc   ;==>_FreeImage_SetOutputMessageStdCall

;~ DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf); CDELC is not good for Autoit, use STDCALL above
Func _FreeImage_SetOutputMessage($FreeImage_OutputMessageFunction)
    ;Author: Prog@ndy
    DllCall($__g_hFREEIMAGEDLL, "none", (($b___FeeImageIsx64)?("FreeImage_SetOutputMessage"):("_FreeImage_SetOutputMessage@4")), "ptr", $FreeImage_OutputMessageFunction)
    If @error Then Return SetError(1, @error)
EndFunc   ;==>_FreeImage_SetOutputMessage
;~ DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);

An example would be welcome.

Edited by c.haslam

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
Share on other sites

The link http://progandy.de/downloads/viewdownload/3-autoit-udfs/7-freeimage-library gives the error "

Forbidden

You don't have permission to access /downloads/viewdownload/3-autoit-udfs/7-freeimage-library on this server.

 

I was finally able to find a download of FreeImage.au3 elsewhere, but I assume it's out of date because every time I try to open an altered image it gives the error "It looks like we don't support this file format." Testing on a .jpg image.

 

Do I need to do something special in order to download the above UDF? Thanks in advance!

Share this post


Link to post
Share on other sites

With the FreeImageX64.zip FreeImage.DLL from above, the altered .jpg doesn't seem to be changed because when I open it, I don't get an error, but it hasn't been visibly altered.  I haven't added it to a path, but it's in the include folder with the script.

Edited by Poconnor2018

Share this post


Link to post
Share on other sites

I need to transform a jpg into tiff but with an old-style jpeg compression.

This type of compression is included into .DLL, but I was not able to use it.

I need this type of compression because it's used by my business software.

Could you help me?

Sorry for my bad english :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...