Function Reference


_GDIPlus_ImageSaveToFileEx

Save an image to file

#include <GDIPlus.au3>
_GDIPlus_ImageSaveToFileEx ( $hImage, $sFileName, $sEncoder [, $tParams = 0] )

Parameters

$hImage Handle to an image object
$sFileName Fully qualified image file name
$sEncoder GUID string of encoder to be used
$tParams [optional] a $tagGDIPENCODERPARAMS structure or a pointer to it

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPID_ERR*).

Related

$tagGDIPENCODERPARAMS, _GDIPlus_ImageLoadFromFile, _GDIPlus_ImageSaveToFile

See Also

Search GdipSaveImageToFile in MSDN Library.

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Example()

Func Example()
    Local $hImage, $sCLSID, $tData, $tParams

    ; Capture screen
    _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image.jpg")

    ; Initialize GDI+ library
    _GDIPlus_Startup()

    ; Load image
    $hImage = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\GDIPlus_Image.jpg")

    ; Get JPEG encoder CLSID
    $sCLSID = _GDIPlus_EncodersGetCLSID("JPG")

    ; Set up parameters for 90 degree rotation
    $tData = DllStructCreate("int Data")
    DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
    $tParams = _GDIPlus_ParamInit(1)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))

    ; Save image with rotation
    _GDIPlus_ImageSaveToFileEx($hImage, @MyDocumentsDir & "\GDIPlus_Image2.jpg", $sCLSID, $tParams)

    ; Shut down GDI+ library
    _GDIPlus_Shutdown()

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image2.jpg")
EndFunc   ;==>Example