Jump to content
Sign in to follow this  
Edano

Image Filters / Graphical Effects ?

Recommended Posts

Edano

i searched the forum, but didn't find anything.

has anyone an idea or ever done it with autoit ? simple image transforming, like sharpness, brightness, blurring etc. ?

maybe, does gdiplus.dll feature that ?

here is a tutorial on how to do it the hard (mathematical) way. http://lodev.org/cgtutor/filtering.html before i try that, i wanted to know if there is already an existing project or an idea or anyone has experiences.

thx

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
UEZ

GDI+ is the thing you are searching for. Have a look to

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Edano

will go look. thx. this is not in the standard includes ?

 

Edit: wow. several cool impressing things, and so fast. it's time that someone puts together all the pieces.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Malkey

If you want to use a colour matrix to manipulate an image, you might find interesting.

Share this post


Link to post
Share on other sites
Edano

@malkey: yes yes, exactly, :) matrices and convolutions is what i think of. there is a but i don't get the FASM functions to work

would be nice to get sth done like this: http://www.codeproject.com/Articles/2008/Image-Processing-for-Dummies-with-C-and-GDI-Part-2

thank you malkey and uez

Screenshot.jpg

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Edano

@malkey your example script is excellent ! just what i need. will be trying different matrices. thx


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
UEZ

Here some more stuff to play with:

 

;http://msdn.microsoft.com/en-us/library/windows/desktop/ms534056(v=vs.85).aspx
#AutoIt3Wrapper_UseX64=n
#include <GDIPlus.au3>
#include <Memory.au3>
Opt("MustDeclareVars", 1)

Global Const $GDIP_BLUREFFECT = "{633C80A4-1843-482b-9EF2-BE2834C5FDD4}"
Global Const $GDIP_BRIGHTNESSCONTRASTEFFECT = "{D3A1DBE1-8EC4-4c17-9F4C-EA97AD1C343D}"
Global Const $GDIP_COLORBALANCEEFFECT = "{537E597D-251E-48da-9664-29CA496B70F8}"
Global Const $GDIP_COLORCURVEEFFECT = "{DD6A0022-58E4-4a67-9D9B-D48EB881A53D}"
Global Const $GDIP_COLORLUTEFFECT = "{A7CE72A9-0F7F-40d7-B3CC-D0C02D5C3212}"
Global Const $GDIP_COLORMATRIXEFFECT = "{718F2615-7933-40e3-A511-5F68FE14DD74}"
Global Const $GDIP_HUESATURATIONLIGHTNESSEFFECT = "{8B2DD6C3-EB07-4d87-A5F0-7108E26A9C5F}"
Global Const $GDIP_LEVELSEFFECT = "{99C354EC-2A31-4f3a-8C34-17A803B33A25}"
Global Const $GDIP_REDEYECORRECTIONEFFECT = "{74D29D05-69A4-4266-9549-3CC52836B632}"
Global Const $GDIP_SHARPENEFFECT = "{63CBF3EE-C526-402c-8F71-62C540BF5142}"
Global Const $GDIP_TINTEFFECT = "{1077AF00-2848-4441-9489-44AD4C2D7A2C}"

_GDIPlus11_Startup()
If @error Then Exit MsgBox(0x40010, "Error", "GDI+ Effect Collection can run on operating systems Vista or newer only!")

Global $hBitmap = _GDIPlus_BMPFromMemory(_RedEye())
Global $iW = _GDIPlus_ImageGetWidth($hBitmap)
Global $iH = _GDIPlus_ImageGetHeight($hBitmap)
Global $hGUI = GUICreate("GDI+ v1.1 Effect Collection by UEZ 2013", $iW * 2, $iH, -1 , 100)
GUISetState()

Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, $iW, 0, $iW, $iH)

Global $hEffect

Global $tRECTF = DllStructCreate($tagGDIPRECTF)
DllStructSetData($tRECTF, "X", 0)
DllStructSetData($tRECTF, "Y", 0)
DllStructSetData($tRECTF, "Width", $iW)
DllStructSetData($tRECTF, "Height", $iH)


;Color LUT
Global Const $tagCOLORLUTPARAMS = "byte ColorChannelLUTB[256];byte ColorChannelLUTG[256];byte ColorChannelLUTR[256];byte ColorChannelLUTA[256]"
Global $tColorLUT = DllStructCreate($tagCOLORLUTPARAMS), $tColorColorChannelLUT
For $i = 192  To 256
    DllStructSetData($tColorLUT, "ColorChannelLUTR", 0xA0, $i)
    DllStructSetData($tColorLUT, "ColorChannelLUTG", 0xB0, $i)
    DllStructSetData($tColorLUT, "ColorChannelLUTB", 0xC0, $i)
Next
$hEffect = _GDIPlus_ColorLUT($tColorLUT)
ConsoleWrite("Color LUT" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Blur
Global Const $tagBLURPARAMS = "float radius;bool expandEdge" ;0-255; False/True
Global $tBlur = DllStructCreate($tagBLURPARAMS)
$hEffect = _GDIPlus_Blur($tBlur, 10)
ConsoleWrite("Blur" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Brightness Contrast
Global Const $tagBRIGHTNESSCONTRASTPARAMS = "int brightnessLevel;int contrastLevel" ;-255-255; -100-100
Global $tBrightnessContrast = DllStructCreate($tagBRIGHTNESSCONTRASTPARAMS)
$hEffect = _GDIPlus_BrightnessContrast($tBrightnessContrast, -60, 90)
ConsoleWrite("Brightness Contrast" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Color Balance
Global Const $tagCOLORBALANCEPARAMS = "int cyanRed;int magentaGreen;int yellowBlue" ;-100-100; -100-100; -100-100
Global $tColorBalance = DllStructCreate($tagCOLORBALANCEPARAMS)
$hEffect = _GDIPlus_ColorBalance($tColorBalance, 60, -50, 20)
ConsoleWrite("Color Balance" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Color Curve
Global Enum $iAdjustExposure = 0, $iAdjustDensity, $iAdjustContrast, $iAdjustHighlight, $iAdjustShadow, _ ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms534098(v=vs.85).aspx
            $iAdjustMidtone, $iAdjustWhiteSaturation, $iAdjustBlackSaturation
Global Enum $iCurveChannelAll = 0, $iCurveChannelRed, $iCurveChannelGreen, $iCurveChannelBlue ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms534100(v=vs.85).aspx
Global Const $tagCOLORCURVEEFFECTPARAMS = "int type;int channel;int value"
Global $tColorCurve = DllStructCreate($tagCOLORCURVEEFFECTPARAMS)
; Value ranges for adjustment parameters
; $iAdjustExposure, $iAdjustDensity -255 - 255
; $iAdjustContrast, $iAdjustHighlight, $iAdjustShadow, $iAdjustMidtone  -100 - 100
; $iAdjustWhiteSaturation, $iAdjustBlackSaturation  0 - 255

$hEffect = _GDIPlus_ColorCurve($tColorCurve, $iAdjustHighlight, $iCurveChannelAll, 90)
ConsoleWrite("Color Curve" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Color Matrix
Global Const $tagGDIPCOLORMATRIXPARAMS = "float m[25];"
Global $tColorMatrix = DllStructCreate($tagGDIPCOLORMATRIXPARAMS)
Global $fRed = 0.66, $fGreen = 0.5, $fBlue = 0.5, $fAlpha = 1
$hEffect = _GDIPlus_ColorMatrix($tColorMatrix, $fRed, $fGreen, $fBlue, $fAlpha)
ConsoleWrite("Color Matrix" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Hue Saturation Lightness
Global Const $tagHUESATURATIONLIGHTNESSPARAMS = "int hueLevel;int saturationLevel;int lightnessLevel" ;-180-180; -100-100; -100-100
Global $tHueSaturationLightness = DllStructCreate($tagHUESATURATIONLIGHTNESSPARAMS)
$hEffect = _GDIPlus_HueSaturationLightness($tHueSaturationLightness, 90, -50, 20)
ConsoleWrite("Hue Saturation Lightness" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Levels
Global Const $tagLEVELSPARAMS = "int highlight;int midtone;int shadow" ;0-100; -100-100; 0-100
Global $tLevels = DllStructCreate($tagLEVELSPARAMS)
$hEffect = _GDIPlus_Levels($tLevels, 60, -50, 20)
ConsoleWrite("Levels" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Sharpen
Global Const $tagSHARPENPARAMS = "float radius;float amount" ;0-255; 0-100
Global $tSharpen = DllStructCreate($tagSHARPENPARAMS)
$hEffect = _GDIPlus_Sharpen($tSharpen, 60, 90)
ConsoleWrite("Sharpen" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)

;Tint
Global Const $tagTINTPARAMS = "int hue;int amount" ;-180-180; -100-100
Global $tTint = DllStructCreate($tagTINTPARAMS)
$hEffect = _GDIPlus_Tint($tTint, 60, 40)
ConsoleWrite("Tint" & @CRLF)
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $hEffect)
_GDIPlus_EffectDispose($hEffect)
Sleep(3000)


;Red Eye -> http://msdn.microsoft.com/en-us/library/windows/desktop/ms534928(v=vs.85).aspx
Global $nNumRects = 2
Global $tRECTs = DLLStructCreate("long[" & $nNumRects * 4  & "];")
DllStructSetData($tRECTs, 1, 50, 1)
DllStructSetData($tRECTs, 1, 64, 2)
DllStructSetData($tRECTs, 1, 50 + 22, 3)
DllStructSetData($tRECTs, 1, 64 + 18, 4)
DllStructSetData($tRECTs, 1, 155, 5)
DllStructSetData($tRECTs, 1, 64, 6)
DllStructSetData($tRECTs, 1, 155 + 21, 7)
DllStructSetData($tRECTs, 1, 64 + 18, 8)
Global Const $pRECTs = DllStructGetPtr($tRECTs)
Global Const $tagREDEYECORRECTIONPARAMS = "uint numberOfAreas;ptr areas;"
Global $tRedEye = DllStructCreate($tagREDEYECORRECTIONPARAMS)
DllStructSetData($tRedEye, "numberOfAreas", $nNumRects)
DllStructSetData($tRedEye, "areas", $pRECTs)

Global $pEffect = _GDIPlus_EffectCreate($GDIP_REDEYECORRECTIONEFFECT)
ConsoleWrite("Red Eye" & @CRLF)
_GDIPlus_EffectsSetParameters($pEffect, $tRedEye, (DllStructGetSize($tRECTs) + DllStructGetSize($tRedEye)) / DllStructGetSize($tRedEye))
_GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $pEffect)

;~ $hBitmap_Effect = _GDIPlus_BitmapCreateApplyEffect($hBitmap, $pEffect)
;~ _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap_Effect, 0, 0)


$tBlur = 0
$tTint = 0
$tColorCurve = 0
$tSharpen = 0
$tColorMatrix = 0
$tBrightnessContrast = 0
$tLevels = 0
$tColorBalance = 0
$tColorColorChannelLUT = 0
$tRedEye = 0
$tRECTF = 0

MsgBox(0, "", "Done", 15)

Do
Until GUIGetMsg() = -3


_GDIPlus_BitmapDispose($hBitmap)
;~ _GDIPlus_BitmapDispose($hBitmap_Effect)
_GDIPlus_GraphicsDispose($hGraphics)

_GDIPlus_Shutdown()

Exit

Func _GDIPlus_Blur($tBlur, $fRadius, $bExpandEdge = False)
    If Not IsDllStruct($tBlur) Then Return SetError(1, @error, 0)
    DllStructSetData($tBlur, "radius", $fRadius)
    DllStructSetData($tBlur, "expandEdge", $bExpandEdge)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_BLUREFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tBlur)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_BrightnessContrast($tBrightnessContrast, $iBrightnessLevel, $iContrastLevel)
    If Not IsDllStruct($tBrightnessContrast) Then Return SetError(1, @error, 0)
    DllStructSetData($tBrightnessContrast, "brightnessLevel", $iBrightnessLevel)
    DllStructSetData($tBrightnessContrast, "contrastLevel", $iContrastLevel)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_BRIGHTNESSCONTRASTEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tBrightnessContrast)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_ColorBalance($tColorBalance, $iCyanRed, $iMagentaGreen, $iYellowBlue)
    If Not IsDllStruct($tColorBalance) Then Return SetError(1, @error, 0)
    DllStructSetData($tColorBalance, "cyanRed", $iCyanRed)
    DllStructSetData($tColorBalance, "magentaGreen", $iMagentaGreen)
    DllStructSetData($tColorBalance, "yellowBlue", $iYellowBlue)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORBALANCEEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tColorBalance)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_ColorCurve($tColorCurve, $iType, $iChannel, $iValue)
    If Not IsDllStruct($tColorCurve) Then Return SetError(1, @error, 0)
    DllStructSetData($tColorCurve, "type", $iType)
    DllStructSetData($tColorCurve, "channel", $iChannel)
    DllStructSetData($tColorCurve, "value", $iValue)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORCURVEEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tColorCurve)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_ColorLUT($tColorLUT)
    If Not IsDllStruct($tColorLUT) Then Return SetError(1, @error, 0)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORLUTEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tColorLUT)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_ColorMatrix($tColorMatrix, $fRed, $fGreen, $fBlue, $fAlpha)
    If Not IsDllStruct($tColorMatrix) Then Return SetError(1, @error, 0)
    DllStructSetData($tColorMatrix, "m", $fRed, 1)
    DllStructSetData($tColorMatrix, "m", $fGreen, 7)
    DllStructSetData($tColorMatrix, "m", $fBlue, 13)
    DllStructSetData($tColorMatrix, "m", $fAlpha, 19)
    DllStructSetData($tColorMatrix, "m", 1, 25) ;the element in the fifth row and fifth column of a 5×5 homogeneous matrix must be 1, and all of the other elements in the fifth column must be 0
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_COLORMATRIXEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tColorMatrix)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_HueSaturationLightness($tHueSaturationLightness, $iHueLevel, $iSaturationLevel, $iLightnessLevel)
    If Not IsDllStruct($tHueSaturationLightness) Then Return SetError(1, @error, 0)
    DllStructSetData($tHueSaturationLightness, "hueLevel", $iHueLevel)
    DllStructSetData($tHueSaturationLightness, "saturationLevel", $iSaturationLevel)
    DllStructSetData($tHueSaturationLightness, "lightnessLevel", $iLightnessLevel)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_HUESATURATIONLIGHTNESSEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tHueSaturationLightness)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_Levels($tLevels, $iHighlight, $iMidtone, $iShadow)
    If Not IsDllStruct($tLevels) Then Return SetError(1, @error, 0)
    DllStructSetData($tLevels, "highlight", $iHighlight)
    DllStructSetData($tLevels, "midtone", $iMidtone)
    DllStructSetData($tLevels, "shadow", $iShadow)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_LEVELSEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tLevels)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_Sharpen($tSharpen, $fRadius, $fAmount)
    If Not IsDllStruct($tSharpen) Then Return SetError(1, @error, 0)
    DllStructSetData($tSharpen, "radius", $fRadius)
    DllStructSetData($tSharpen, "amount", $fAmount)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_SHARPENEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tSharpen)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_Tint($tTint, $iHue, $iAmount)
    If Not IsDllStruct($tTint) Then Return SetError(1, @error, 0)
    DllStructSetData($tTint, "hue", $iHue)
    DllStructSetData($tTint, "amount", $iAmount)
    Local $pEffect = _GDIPlus_EffectCreate($GDIP_TINTEFFECT)
    If @error Then Return SetError(2, @error, 0)
    _GDIPlus_EffectsSetParameters($pEffect, $tTint)
    If @error Then Return SetError(3, @error, 0)
    Return $pEffect
EndFunc

Func _GDIPlus_EffectCreate($sEffectGUID, $pEffect = 0)
    Local $iI, $tGUID, $pGUID, $tElem, $aElem[4], $aResult
    $tGUID = _WinAPI_GUIDFromString($sEffectGUID)
    $pGUID = DllStructGetPtr($tGUID)
    $tElem = DllStructCreate("uint[4]", $pGUID)
    For $iI = 1 To 4
        $aElem[$iI - 1] = DllStructGetData($tElem, 1, $iI)
    Next
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateEffect", "uint", $aElem[0], "uint", $aElem[1], "uint", $aElem[2], "uint", $aElem[3], "uint*", $pEffect)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[5])
EndFunc   ;==>_GDIPlus_EffectCreate

Func _GDIPlus_EffectsSetParameters($pEffectObject, $tEffectParameters, $iSizeAdj = 1)
    Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "ptr", $pEffectObject, "uint*", 0)
    Local $iSize = $aSize[2] * $iSizeAdj
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetEffectParameters", "ptr", $pEffectObject, "struct*", $tEffectParameters, "uint", $iSize)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[3])
EndFunc   ;==>_GDIPlus_EffectsSetParameters

Func _GDIPlus_BitmapCreateApplyEffect($hBitmap, $pEffect, $pROI = 0, $tOutRect = 0, $hBmpOutput = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapCreateApplyEffect", _
            "ptr*", $hBitmap, _
            "int", 1, _
            "ptr", $pEffect, _
            "ptr", $pROI, _
            "struct*", $tOutRect, _
            "int*", $hBmpOutput, _
            "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[6])
EndFunc   ;==>_GDIPlus_BitmapCreateApplyEffect

Func _GDIPlus_EffectDispose($pEffect)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteEffect", "ptr", $pEffect)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_EffectDispose

Func _GDIPlus_BitmapApplyEffect($hBitmap, $pEffect, $pROI = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapApplyEffect", "handle", $hBitmap, "ptr", $pEffect, "ptr", $pROI, "int", 0, "ptr*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_BitmapApplyEffect

Func _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $pEffect, $hMatrix = 0, $pImgAttributes = 0, $iUnit = 2)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDrawImageFX", "handle", $hGraphics, _
            "handle", $hBitmap, _
            "struct*", $tRECTF, _
            "handle", $hMatrix, _
            "ptr", $pEffect, _
            "ptr", $pImgAttributes, _
            "uint", $iUnit)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_DrawImageFX

Func _GDIPlus11_Startup() ;code by Authenticity - modified by UEZ
    Local $pInput, $tInput, $pToken, $tToken, $aResult, $sGDIPDLL, $sVer

    $giGDIPRef += 1
    If $giGDIPRef > 1 Then Return True

    Switch @OSVersion
        Case "WIN_VISTA", "WIN_2008"
            $sGDIPDLL = @WindowsDir & "\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6000.16386_none_8df21b8362744ace\gdiplus.dll"
        Case Else
            $sGDIPDLL = @SystemDir & "\gdiplus.dll"
    EndSwitch
    $sVer = FileGetVersion($sGDIPDLL)
    If $sVer < "6.0" Then Return SetError(1, 0, False) ;For XP you need a GDIPlus.dll v1.1 in the script directory, refer to: http://www.winsxs.org/?OtherTech/thread-13-1-1

    $ghGDIPDll = DllOpen($sGDIPDLL)
    $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    $tToken = DllStructCreate("int Data")
    DllStructSetData($tInput, "Version", 1)
    $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(2, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus11_Startup


#region Example Image
;======================================================================================
; Function Name:        _GDIPlus_BMPFromMemory
; Description:          Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap
;
; Parameters:           $bImage:    the binary string which contains any valid image which is supported by GDI+
; Optional:             $hHBITMAP:  if false a bitmap will be created, if true a hbitmap will be created
;
; Remark:               hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format
;                       Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown()
;
; Requirement(s):       GDIPlus.au3, Memory.au3 and _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
; Return Value(s):      Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format),
;                       Error: 0
; Error codes:          1: $bImage is not a binary string
;                       2: unable to create stream on HGlobal
;                       3: unable to create bitmap from stream
;
; Author(s):            UEZ
; Additional Code:      thanks to progandy for the MemGlobalAlloc and tVARIANT lines and
;                       Yashied for _WinAPI_BitmapCreateDIBFromBitmap() from WinAPIEx.au3
; Version:              v0.98 Build 2012-08-29 Beta
;=======================================================================================
Func _GDIPlus_BMPFromMemory($bImage, $hHBITMAP = False)
    If Not IsBinary($bImage) Then Return SetError(1, 0, 0)
    Local $aResult
    Local Const $memBitmap = Binary($bImage) ;load image  saved in variable (memory) and convert it to binary
    Local Const $len = BinaryLen($memBitmap) ;get length of image
    Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory  ($GMEM_MOVEABLE = 0x0002)
    Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer
    Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct
    DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
    _MemGlobalUnlock($hData) ;decrements the lock count  associated with a memory object that was allocated with GMEM_MOVEABLE
    $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents
    If @error Then Return SetError(2, 0, 0)
    Local Const $hStream = $aResult[3]
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface
    If @error Then Return SetError(3, 0, 0)
    Local Const $hBitmap = $aResult[2]
    Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr")
    DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _
                                           "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak
    $tMem = 0
    $tVARIANT = 0
    If $hHBITMAP Then
        Local Const $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap)
        _GDIPlus_BitmapDispose($hBitmap)
        Return $hHBmp
    EndIf
    Return $hBitmap
EndFunc   ;==>_GDIPlus_BMPFromMemory

Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported)
    Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0
    $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0)
    If (@error) Or ($aRet[0]) Then Return 0
    $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    $pBits = DllStructGetData($tData, 'Scan0')
    If Not $pBits Then Return 0
    $tBIHDR = DllStructCreate(  'dword bV5Size;long bV5Width;long bV5Height;word bV5Planes;word bV5BitCount;dword bV5Compression;' & _ ;http://msdn.microsoft.com/en-us/library/windows/desktop/dd183381(v=vs.85).aspx
                                                                'dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;'  & _
                                                                'dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;' & _
                                                                'int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;' & _
                                                                'dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved')
    DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR))
    DllStructSetData($tBIHDR, 'bV5Width', $aRet[2])
    DllStructSetData($tBIHDR, 'bV5Height', $aRet[3])
    DllStructSetData($tBIHDR, 'bV5Planes', 1)
    DllStructSetData($tBIHDR, 'bV5BitCount', 32)
    DllStructSetData($tBIHDR, 'bV5Compression', 0) ; $BI_BITFIELDS = 3, $BI_RGB = 0, $BI_RLE8 = 1, $BI_RLE4 = 2, $RGBA = 0x41424752
    DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride'))
    DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000)
    DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000)
    DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00)
    DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF)
    DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2
    DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA
    $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0)
    If (Not @error) And ($hResult[0]) Then
        DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0'))
        $hResult = $hResult[0]
    Else
        $hResult = 0
    EndIf
    _GDIPlus_BitmapUnlockBits($hBitmap, $tData)
    $tData = 0
    $tBIHDR = 0
    Return $hResult
EndFunc   ;==>_WinAPI_BitmapCreateDIBFromBitmap

;Code below was generated by: 'File to Base64 String' Code Generator v1.11 Build 2012-10-13

Func _RedEye($bSaveBinary = False)
    Local $RedEye
    $RedEye &= '/9j/4AAQSkZJRgABAQEBLAEsAAD//gBERmlsZSBzb3VyY2U6IGh0dHA6Ly9jb21tb25zLndpa2ltZWRpYS5vcmcvd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DPKg01TsC6rWJ43FNfoK5kCQNJmnCtDkkygGABNNjnfsvcUUztG3rNaRz53ZX1G40NPOpEeQx6YoyvTKTt5v1jrvULbqLrNq8W2kQNMcwKMMJZtr/Uyx6j//2Q=='
    Local $bString = Binary(_Base64Decode($RedEye))
    If $bSaveBinary Then
        Local $hFile = FileOpen(@ScriptDir & "\220px-BoldRedEye.JPG", 18)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return  $bString
EndFunc   ;==>_RedEye

Func _Base64Decode($sB64String)
    Local $struct = DllStructCreate("int")
    Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $sB64String, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(1, 0, "")
    Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
    $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $sB64String, "int", 0, "int", 1, "ptr", DllStructGetPtr($a), "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($a, 1)
EndFunc   ;==>_Base64Decode
#endregion
Requirements: Vista or higher operating systems!

 

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Edano

Hello Everyone with XP !

Here are instructions on How to make GdiPlus.dll v1.1 work on an XP computer. if you have any objections, or you think it belongs to a different topic, or it is redundant, please tell me and i will move/remove the post.

-

i refer to an existing Win7 system, and that is just all you need. Vista and Win8 work the same.

these instructions do not make any changes to the system or to autoit, so you don't have to worry to undo any changes.

 

1.)  follow the steps described here: http://www.winsxs.org/?OtherTech/thread-13-1-1 . only the paragraph "How to make an available GDI+ 1.1 DLL for Windows XP" is important. don't download the attachments.

the directories on Win7 where you find the gdiplus.dll and the .manifest may have different version names. be sure you choose corresponding directories that contain the same "xxx_1.1.xxx" version number.

important: when you use the hex-editor on gdiplus.dll to exchange "_ftol2" and"_ftol2_sse" to "ftol", use zero [00] bytes to replace "2" resp. "2_sse". do not use the replace function of the hex editor.

 

2.)  make changes to your scripts that are supposed to use the gdiplus 1.1 functionalities:

add your own "__GDIPlus_Startup()" function to your script (note, only the @scriptdir is added (and several existing bugs repaired) and use it instead of "_GDIPlus_Startup()":

.

Func __GDIPlus_Startup()
    $giGDIPRef += 1
    If $giGDIPRef > 1 Then Return True

    ; check system version first
    Global $ghGDIP_DLL_location="GDIPlus.dll"; sometimes needed eg for convolution.au3
    If Number(FileGetVersion($ghGDIP_DLL_location))<6 Then; OS Vista or higher v 6.x.x.x

        ; OS XP v 5.x.x.x
        $ghGDIP_DLL_location=@ScriptDir&"\GDIPlus.dll"; check local
        If Number(FileGetVersion($ghGDIP_DLL_location))<6 Then
            MsgBox(0x40010,"Error","This script only runs on OS Vista or higher."&@CRLF&@CRLF&"For XP you need a GDIPlus.dll v1.1 in the script directory, refer to:       "&@CRLF&"http://www.winsxs.org/?OtherTech/thread-13-1-1")
            Return False
        EndIf
    EndIf

    $ghGDIPDll = DllOpen($ghGDIP_DLL_location)
    If $ghGDIPDll = -1 Then
        $giGDIPRef = 0
        Return SetError(1, 2, False)
    EndIf

    Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    Local $tToken = DllStructCreate("ulong_ptr Data")
    DllStructSetData($tInput, "Version", 1)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>__GDIPlus_Startup

.

3.)  put the three files from 1.) into your script directory. (GdiPlus.dll, msvaaa.dll, and Microsoft.Windows.GdiPlus.MANIFEST). make sure you "fileinstall" them to your script for using in other places.

 

that's all. it's not really much to do and i tested it and it works 100%.

 

have fun

Edit: no changes needed for the includes !

Edit: updated __GDIPlus_Startup() script

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Edano

@UEZ, if you come along,

no matter what OS (i have xp, vista, win7 for testing), i always get an error on this line:

Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "handle", $hEffectObject, "uint*", 0)

i would love to get your example working .... :)


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
UEZ

@UEZ, if you come along,

no matter what OS (i have xp, vista, win7 for testing), i always get an error on this line:

Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "handle", $hEffectObject, "uint*", 0)

i would love to get your example working .... :)

 

What is the error message?

Anybody else with problems?

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Edano

@extended = 0, @error = 1. how can i obtain a more detailed error message ?


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Malkey

The error message I get revealed by pressing the "View problem details" button of the "Check online ...""Close the program" popup window displays:-

Problem signature:
  Problem Event Name:    APPCRASH
  Application Name:    autoit3_x64.exe
  Application Version:    3.3.8.1
  Application Timestamp:    4f25bafd
  Fault Module Name:    gdiplus.dll
  Fault Module Version:    6.1.7601.17825
  Fault Module Timestamp:    4f9242bf
  Exception Code:    c0000005
  Exception Offset:    0000000000046322
  OS Version:    6.1.7601.2.1.0.256.48
  Locale ID:    3081
  Additional Information 1:    ea36
  Additional Information 2:    ea360d0a44299c1a12e49ee0269325a4
  Additional Information 3:    ecc7
  Additional Information 4:    ecc7684e41a60fe1ac69846f6d066351

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\System32\en-USerofflps.txt



Running on AutoIt Beta version works fine.

Share this post


Link to post
Share on other sites
UEZ

Using x64 mode the app crashes for me, too! Use at the top of the script

#AutoIt3Wrapper_UseX64=n

You need the full SciTE package!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Edano

oh boy ... ;) scripting was easier in pre-vista times ...


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Edano

i fear i need another GDIPlus push from you. please help me understand it.

here is what i made so far, it's not much :( flip/rotate and zoom an image.

what i want to add is: brightness, contrast, sharpen, maybe blur and emboss if possible, and possibly matrix operations, but i don't get all the examples together. in fact, any effect would be nice.

i would like to preserve the given idea to use a pic control, because it has no problem with repainting issues.

#Include <GDIPlus.au3>


$Path=FileOpenDialog("Choose an Image  (preferably smaller than your desktop)",@ScriptDir,"Images (*.gif;*.png;*.jpg;*.bmp;*.tif)")
If $Path="" Then Exit

$RFB_Child=GUICreate("",100,100,85,85,0x80800000);BitOR($WS_BORDER,$WS_POPUP))
$RFB_Pic=GUICtrlCreatePic("",0,0,100,100)
GUICtrlSetResizing(-1,102)
GUICtrlSetCursor(-1,0)

_GDIPlus_Startup()

$hImage=_GDIPlus_ImageLoadFromFile($Path)
$iw=_GDIPlus_ImageGetWidth($hImage)
$ih=_GDIPlus_ImageGetHeight($hImage)

WinMove($RFB_Child,"",(@DesktopWidth-$iw)/2,(@DesktopHeight-$ih)/2+8,$iw+2,$ih+2)

_SetImage()

GUISetOnEvent(-7,"_Drag")
GUISetState()

MsgBox(0,"GDIPlus effects","now flip")
;    $RotateNoneFlipNone = 0 , _
;    $Rotate90FlipNone = 1 , _
;    $Rotate180FlipNone = 2 , _
;    $Rotate270FlipNone = 3 , _
;    $RotateNoneFlipX = 4 , _
;    $Rotate90FlipX = 5 , _
;    $Rotate180FlipX = 6 , _
;    $Rotate270FlipX = 7 , _
;    $RotateNoneFlipY = 6 , _
;    $Rotate90FlipY = 7 , _
;    $Rotate180FlipY = 4 , _
;    $Rotate270FlipY = 5 , _
;    $RotateNoneFlipXY = 6 , _
;    $Rotate90FlipXY = 7 , _
;    $Rotate180FlipXY = 0 , _
;    $Rotate270FlipXY = 1
DllCall($ghGDIPDll,"int","GdipImageRotateFlip","hwnd",$hImage,"long",6)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","now zoom ...")
$ret=DllCall($ghGDIPDll,"int","GdipGetImageThumbnail","ptr",$hImage,"int",$iw*2,"int",$ih*2,"ptr*",0,"ptr",0,"ptr",0)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
    _GDIPlus_ImageDispose($hImage)
    $hImage=$ret[4]
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","... and restore")
$ret=DllCall($ghGDIPDll,"int","GdipGetImageThumbnail","ptr",$hImage,"int",$iw,"int",$ih,"ptr*",0,"ptr",0,"ptr",0)
If @error Then
    MsgBox(0,"Error "&@error,@extended)
Else
    _GDIPlus_ImageDispose($hImage)
    $hImage=$ret[4]
    _SetImage()
EndIf

MsgBox(0,"GDIPlus effects","ready")




;   more effects ?




_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()

Func _SetImage()
    $hBitmap=_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hWnd=GUICtrlGetHandle($RFB_Pic)
    ;_GDIPlus_ImageDispose($hImage)
    _WinAPI_SetWindowLong($hWnd,0xFFFFFFF0,BitOR(_WinAPI_GetWindowLong($hWnd,0xFFFFFFF0),0x0E));$__SS_BITMAP;; $GWL_STYLE)
    _WinAPI_DeleteObject(_SendMessage($hWnd,0x0172,0,$hBitmap));$__STM_SETIMAGE
    _WinAPI_DeleteObject($hBitmap);das global behalten ???
EndFunc

Func _Drag()
    DllCall("user32.dll","int","SendMessage","hwnd",@GUI_WinHandle,"int",274,"int",0xF012,"int",0)
EndFunc

.

i would love to understand the logic. i found this excellent documentation: http://www.jose.it-berater.org/gdiplus/iframe/index.htm

 

Edit: i forgot Opt("GUIOnEventMode",1) in the script

.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Edano

imo, there is a bug in uez's example script. according to msdn and http://www.jose.it-berater.org/gdiplus/iframe/index.htm , GdipGetEffectParameterSize needs a pointer to the effect structure, not a handle. so, the line

Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "handle", $hEffectObject, "uint*", 0)

changed into

Local $aSize = DllCall($ghGDIPDll, "uint", "GdipGetEffectParameterSize", "ptr", $hEffectObject, "uint*", 0)

does not throw out an error, but a reasonable value for $aSize[2]=1024 (for blur).

the same must be true for GdipSetEffectParameters. still, the example does not work for me, but at least i am one step forward. and i don't understand why it works for other people, but i keep working on it.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
UEZ

Thanks for the hint. The conversation from MSN might be buggy. If you find some bugs please report it.

Currently I'm writing a tool with all the effects from above and some more. When it's finished I will post it to the example section.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Edano

i just wonder why it only crashes for me, i am working parallel on three OS , xp, vista and win7. with "ptr" everything is fine even on xp.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Edano

a little bug i found is that you use the same line

If Not IsDllStruct($tBlur) Then Return SetError(1, @error, 0)

in several effect functions, where it should be $tBrightnessContrast or $tColorBalance instead.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

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  

  • Similar Content

    • Sven-Seyfert
      By Sven-Seyfert
      Hi Community,

      I'm looking for a way to do a Video Overlay GUI or something like that. The idea is to create a GUI which plays a video loop (with transparency/alpha channel) in front of an other GUI. Before you asking why - because I don't believe that GDIPlus can do it out of the box. My skillset for that kind of graphical things isn't good enough to do that, but here are some specialist like @UEZ maybe who can help.

      Example alpha channel video (visualized as animated *.gif):

      I tried to do the light rays effect directly with GDIPlus, but honestly that's a bit too difficult for me. I would be very glad and grateful if there are some suggestions, ideas or recommendations.

      Code for the Video play:
       
      Example video "End.mpeg":
       
      The next challenge is that the overlay GUI should be not clickable. If I hover over the overlay area, I want to have the possibility to control the GUI or what ever, in the background. But if there is any chance to make it with GDIPlus as a Video Overlay for light rays, I would prefer that approach instead of my crazy work-around idea.

      Thanks for any suggestion - I'm grateful!
      Sven
    • RTFC
      By RTFC
      The Eigen C++ template library is a great environment for matrix computing; it is fast, reliable, extensive, and well-documented. It is also completely free, and does not rely on any external dependencies. Unfortunately for AutoIt users, the term “template library” implies that any functions you call are only instantiated upon compilation (in C++). That means there's nothing to hook into.
      To make Eigen ’s most important functionality directly accessible from within AutoIt scripts (version 3.3.12+, download it here), I developed the Eigen4AutoIt environment. It runs on Windows and under Wine also on Linux and Mac (Ubuntu, Debian, Fedora, and MacOS supported by WineHQ), and SUSE, Slackware, and FreeBSD supported by the distros).
      >Download the latest version

      It consists of:
      1) Eigen4AutoIt.au3
      an AutoIt library of wrapper functions that contain extensive bounds checks, matrix management, file I/O, type conversion, and precision control, and two-way data exchange with files and native AutoIt arrays;
      2) Eigen-wrapper dlls (EigenDense.dll, EigenDense_x64.dll)
      re-maps matrices created in AutoIt as Eigen Matrix objects, then calls Eigen’s powerful core functions; the single-precision part of the C++ source code I wrote is included in the bundle (the double-precision, integer, and complex alternatives just duplicate this with different memory mappings and variable types). The basic functions consist of a single Eigen call; decompositions and statistics are more involved. 3) Additional materials:
      the user-interactive, animated Function Selector and MatrixViewer tools the MatrixFileConverter to read/write E4A matrices from/to .csv ASCII, Excel, and Xbase files. three libraries of scientific and mathematical constants online Help Large (.chm) Help file Quickstart Manual (11-page pdf, updated) Test suite Tutorials from Basics to Advanced Please note:
      none of this is part of Eigen's own distribution you only need this bundle; you do not need to install Eigen. How it works:
      No matrix content is ever transferred, only memory pointers, meaning computations in AutoIt are virtually as fast as in Eigen’s native environment, with the added advantage of not having to be compiled first. The drawback is that Eigen's native ad-hoc expression templates (and their internal optimisations) cannot be exploited here; you have to construct your operations with the basic building blocks. These provide matrix creation, I/O, cellwise operations, reduction, multiplication, transformation, decomposition (LU, Householder, Choleski, and Jacobi SVD; these include general linear solvers) and a small statistics module by yours truly.

      IMPORTANT: Posting Rules for this thread:
       
      1) Do not post or PM me any matrix-, maths-, or Eigen-related questions. Eigen has its own User Forum for that (or try math.stackExchange.com). I am not your maths guru! If you post such questions, I will either ignore your post or remind you of this rule.

      2) Do not post or PM me your data sets and/or non-working Eigen4AutoIt scripts; I will not analyse your data or fix your scripts for you! There are many reasons why a linear algebra procedure might fail to produce the answer you expect. You are wielding great mathematical power here, so exploit the fantastic internet resources at your fingertips and learn how to use it. To get you started, I've listed a few video tutorials and other helpful materials in the header remarks of Eigen4AutoIt.au3. Also check out the test scripts, the Tutorials, and the Help file.

      3) I do warmly welcome all of the following:
      remarks, advice, suggestions for improvements, encouragement, cash; bug reports re. the Eigen4AutoIt interface (individual functions that don't work the way they should) and/or the associated dll code (ditto); your own working Eigen4AutoIt templates of general use that you'd like to see implemented in a future release. Regarding that last item, have a look at my PCA tutorial. After the step-by-step stage, I summarise the entire procedure in a "mini script" of Eigen4AutoIt calls. Then I introduce the two internal PCA functions I developed, which replace that script with two simple calls. You can do the same thing, and submit your own functional Eigen4AutoIt script in this thread. If I consider it of general use and can implement it, it may become a new Eigen4AutoIt function in the next release (with source acknowledgement, of course). This means that you'd get a precompiled dll version of your script that will likely run faster and be simpler to call. Thereby this thread would become an Eigen4AutoIt Example Scripts mini forum. It's just a thought.
       
      >Download the latest version (uncompressed size: 31.4 MB)
       
      How to Install
      You need AutoIt version 3.3.12 or later. Extraction (with 7-zip) creates subdirectory Eigen4AutoIt, where you'll find Eigen4AutoIt.ini. Open it, find global variable $EIGEN_DLLPATH, and copy/paste the full absolute path (without trailing backslash) where the Eigen4AutoIt dlls are located on your machine. Save the ini file, open the first tutorial ("intro") in Scite, and start it. This shows basic matrix I/O and mode switching (single versus double precision). If that runs, you're in business.
    • c.haslam
      By c.haslam
      I had thought that _GDIPlus_ImageClone($hImage) removes all property items, but I now know that it copies property items.
      What is the easiest way of copying an image that has property items to another image that does not have property items?
    • c.haslam
      By c.haslam
      I think that _GDIPlus_ImageGetPropertyItem should return a Property Item that can readily be set as a property of another image. Why would one want to do this? A script might (as one of mine does) edit an image of a .jpg file then write the result to a .jpg file. In editing it, in my case, the number of horizontal and vertical pixels change, and the date/time edited should be set as a property. All other property items remain the same. Other GDI+ users may change other properties.
      So an approach is to copy all the property items from image1 to image2, then update a few properties.
      M$ provides a Property Item class (id, length, pointer to an array of values) but _GDIPlus_ImageGetPropertyItem returns something different.
      I think that, wherever reasonable, UDFs that are wrappers for M$ methods should work like M$'s methods. _GDIPlus_ImageGetPropertyItem does not do this:
      While M$ returns 2 values for a value that is a ratio of 2 numbers,  _GDIPlus_ImageGetPropertyItem returns numerator/denominator as a single value (often a Double). _GDIPlus_ImageSetPropertyItem (when included in GDIPlus.au3) will be unable to set ratio property items properly because it cannot know what the numerator and denominator are. So copying such property items will not work properly. M$ has a Void* buffer where the buffer is an array of values but _GDIPlus_ImageGetPropertyItem() returns the values in the same 1-d array as id, length and type. M$'s approach produces a 1-d array with the same number of elements for all property items while _GDIPlus_ImageGetPropertyItem produces a 1-d array with various numbers of elements. To me, this is not good programming practice. For a photo from a Sony camera, the worst case has 1-d array with 67 elements. When combined into a 2-d array with the property items of all properties, there are 66 rows and 67 columns, with many elements not used. So I suggest that _GDIPlus_ImageGetPropertyItem look like this:
      ; #FUNCTION# ==================================================================================================================== ; Name ..........: cGDIPlus_ImageGetPropertyItem ; Description ...: Gets a specified property item (piece of meta data) from an Image object ; Syntax ........: cGDIPlus_ImageGetPropertyItem($hImage, $iPropID) ; Parameters ....: $hImage - Pointer to an image object ; $iPropID - Identifier of the property item to be retrieved ; Return values .: Success: Array containing the values of the property item ; [0] - identifier ; [1] - size, in bytes, of the value array ; [2] - type of value(s) in the value array ; [3] - value array ; Failure: Sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPID_ERR*). ; Author ........: Eukalyptus ; Modified ......: c.haslam ; Remarks .......: types: unsigned byte = 1, ASCII string = 2, unsigned short = 3, unsigned long = 4, ; unsinged rational = 5, undefined = 7, signed long = 9, signed rational = 10 ; Related .......: _GDIPlus_ImageGetPropertyIdList ; Link ..........: https://msdn.microsoft.com/en-us/library/windows/desktop/ms535390(v=vs.85).aspx, ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms534493(v=vs.85).aspx, ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms534414(v=vs.85).aspx ; Example .......: Yes ; =============================================================================================================================== Func cGDIPlus_ImageGetPropertyItem($hImage, $iPropID) Local $iSize = __GDIPlus_ImageGetPropertyItemSize($hImage, $iPropID) If @error Then Return SetError(@error, @extended, -1) Local $tBuffer = DllStructCreate("byte[" & $iSize & "];") Local $pBuffer = DllStructGetPtr($tBuffer) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetPropertyItem", "handle", $hImage, "uint", _ $iPropID, "uint", $iSize, "struct*", $tBuffer) If @error Then Return SetError(@error, @extended, -1) If $aResult[0] Then Return SetError(10, $aResult[0], False) Local $tPropertyItem = DllStructCreate("int id; int length; short type; ptr pvalue;", $pBuffer) Local $iBytes = DllStructGetData($tPropertyItem, "length") Local $pValue = DllStructGetData($tPropertyItem, "pvalue") Local $aRet[4] Local $type = DllStructGetData($tPropertyItem,'type') Local $tValues, $iValues Switch $type Case 2 ;ASCII String $iValues = 1 $tValues = DllStructCreate("char[" & $iBytes & "];", $pValue) Case 3 ;Array of UShort $iValues = Int($iBytes / 2) $tValues = DllStructCreate("ushort[" & $iValues & "];", $pValue) Case 4, 5 ;Array of UInt / Fraction $iValues = Int($iBytes / 4) $tValues = DllStructCreate("uint[" & $iValues & "];", $pValue) Case 9, 10 ;Array of Int / Fraction $iValues = Int($iBytes / 4) $tValues = DllStructCreate("int[" & $iValues & "];", $pValue) Case Else ;Array of Bytes $iValues = 1 $tValues = DllStructCreate("byte[" & $iBytes & "];", $pValue) EndSwitch $aRet[0] = DllStructGetData($tPropertyItem,'id') $aRet[1] = $iBytes $aRet[2] = $type Local $aVals[$iValues] If $type=2 Or $type=7 Then ; ASCII string or undefined $aVals[0] = DllStructGetData($tValues,1) Else For $i = 0 To $iValues-1 $aVals[$i] = DllStructGetData($tValues,1,$i+1) Next EndIf $aRet[3] = $aVals Return $aRet EndFunc And here is an example:
      #include <GDIPlus.au3> #include <Array.au3> Example() Func Example() _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile(RegRead((@AutoItX64 = True ? "HKLM\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt" : "HKLM\SOFTWARE\AutoIt v3\AutoIt"), "InstallDir") & "\Examples\GUI\Torus.png") If @error Then _GDIPlus_Shutdown() MsgBox(16, "", "An error has occured - unable to load image!", 30) Return False EndIf Local $ar = _GDIPlus_ImageGetPropertyIdList($hImage) Local $vPropNbrs[UBound($ar,1)-1] ; Extract ID numbers For $i = 1 To UBound($ar,1)-1 $vPropNbrs[$i-1] = $ar[$i][0] Next ; Get all property items Local $aPropItems[UBound($vPropNbrs)][4],$vPropItem For $i = 0 To UBound($vPropNbrs)-1 $vPropItem = cGDIPlus_ImageGetPropertyItem($hImage,$vPropNbrs[$i]) For $j = 0 To 3 $aPropItems[$i][$j] = $vPropItem[$j] Next Next ; Collapse values arrays so _ArrayDisplay can display them Local $ar = $aPropItems For $i = 0 To UBound($aPropItems,1)-1 $ar[$i][0] = '0x'&Hex($ar[$i][0],4) $ar[$i][3] = '' For $j = 0 To UBound($aPropItems[$i][3])-1 $ar[$i][3] &= ($aPropItems[$i][3])[$j]&'|' Next $ar[$i][3] = StringTrimRight($ar[$i][3],1) Next _ArrayDisplay($ar) _GDIPlus_Shutdown() EndFunc Unfortunately this example (based on one now in the Help) does not exercise most of the item types, but I do not know of a file with EXIF metadata that is on most PCs. I have tested this code by updating and adding property items to torus.jpg and to a photo taken by a Sony camera. The code for implementing and calling _GDIPlus_ImageSetPropertyItem will be fairly simple [see below].
       
      Your thoughts?
       
    • c.haslam
      By c.haslam
      I have a strange symptom of a problem somewhere in my code, or in a UDF: when I add code to get all properties of a GDI+ image to a 6000-line script,  the variable type of a parameter is reported as a pointer when the caller clearly has this argument as a string. If I comment out my code that gets the properties, the function properly sees the parameter as a string.
      [Edit: The reporting as a pointer and getting image properties are miles apart, both in where they are in the script code and in where they are run.]
      At this point, I am looking for clues as to why this is happening, so the hunt is on!
      I have noticed one odd thing, in _GDIPlus_ImageGetPropertyIdList() I see a line that begins Local $sPropertyTagInfo = . This "line" is split into 2 lines. SCiTE shows that the first line is 2454 characters and the second 2400. Adding these numbers I get 4854 characters.
      But the Help for AutoIt3 Limits/defaults says that MAXLINESIZE, Maximum size for a line of script, is 4096 characters.
      The line would exceed the limit if AutoIt considers the subject line to be 1 line and not 2 lines.
      My question: is this line legal? Is buffer overun possible?
×