Jump to content

Recommended Posts

Posted

Made major updates to the DLL and UDF and fixed (probably added new) bugs. All examples changed to new DLL / UDF.

Old scripts may fail when you use DLL v0.4.3+ as function parameters changed.

Added the function to convert APNG to AWEBP.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

  • UEZ changed the title to WebP v0.4.4 build 2025-08-06 beta
Posted

@UEZ Hi
I was thinking at a way to keep all examples unchanged when you increase the Dll version. For example, after the last update, this is what we find in nearly each example script (there are 16 examples actually) :

If WebP_Ver2() < "0.4.4" Then Exit MsgBox($MB_ICONERROR, "ERROR", "DLL Version v0.4.4+ required!", 30)

Which means that when you'll increase the Dll version, you'll have to modify again all the examples (because the constant "0.4.4" is found in each example script)

My idea is to place the constant "0.4.4" in a single place, for example inside the function WebP_Ver2() found in WebP.au3

Actually this is the content of WebP_Ver2()

Func WebP_Ver2($sPath2DLL = "")
    Local $sDLL = Path2DLL($sPath2DLL)
    If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found
    Return DllCall($sDLL, "str", "Web_DLL_Version2")[0]
EndFunc   ;==>WebP_Ver2

It could be modified like this :

Func WebP_Ver2($sPath2DLL = "")
    Local $sDLL = Path2DLL($sPath2DLL)
    If Not FileExists($sDLL) Then Return SetError(1, 0, 0) ;DLL not found
    Local $sDLLversion = DllCall($sDLL, "str", "Web_DLL_Version2")[0]
    If $sDLLversion < "0.4.4" Then ... ; UEZ will choose what to do here and what to return 
    ...
EndFunc   ;==>WebP_Ver2

So you got the idea. The final goal should be to leave all examples untouched when the Dll version increases, which means no more "0.4.4" constant in any example script. Each new version number of the Dll will be indicated only inside the function WebP_Ver2() , then you'll have less work to do while upgrading the Dll (and the user won't have to re-download the examples)

Do you think it's doable ?
Thanks

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

@pixelsearch let me think tomorrow about it.

 

I changed a lot of internal functions from str to wstr to support unicode filenames and all examples must be touched otherwise crash.

 

Currently I'm writing on an example in Freebasic (WebP Encoder GUI) how to use the DLL. Freebasic WebP DLL source code (my written DLL stuff, Google WebP dll will be linked as static library to my DLL) and other stuff can be found on my OneDrive, if you want to have a look under the hood.

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

  • UEZ changed the title to WebP v0.5.0 build 2025-08-10 beta
Posted

@UEZ hi
In "WebP Example05.au3" , if you change the last parameter in the calling function :

Global $tMem = WebP_CreateWebPAdvancedFromBitmap(...
...
True) ;hold the compressed image in memory only, no save to HDD!

to

...
False)

Does it throw this error to the Console ?

Error: 1

 

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

Hi @pixelsearch

you have to provide a filename otherwise error 1. Because the function expects a filename to save if last parameter is false.

The Example05.au3 is not made to save the result to the disk and load it afterwards.

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted (edited)

Thanks for the explanation !

For the record, I am scripting the following, to access easily any of your examples :

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Opt("MustDeclareVars", 1)

If _Doubleton("AutoIt - UEZ WebP all examples") Then Exit ; script already launched + user wants to quit

Example()

;==============================================
Func Example()

    Local $hGUI, $idMenu, $iPID, $nMsg, $sFileName

    Local $aExample[][3] = [ _
        ["01",   "WebP Example01.au3",   "View WebP image (from file, shrinked at 75%)"], _
        ["02",   "WebP Example02.au3",   "View WebP image (from memory, full size)"], _
        ["03",   "WebP Example03.au3",   "WebP image information"], _
        ["04",   "WebP Example04.au3",   "Convert to WebP lossless && lossy (simple), save"], _
        ["05",   "WebP Example05.au3",   "Convert to WebP lossy (advanced), no save"], _
        ["05.1", "WebP Example05.1.au3", "Convert to WebP lossy (advanced), save"], _
        ["06",   "WebP Example06.au3",   "Extract all frames from an animated WebP file"], _
        ["07",   "WebP Example07.au3",   "Play an animated WebP file in GUI (same thread)"], _
        ["08.1", "WebP Example08.1.au3", "Create WebP animation from GDI+ image files"], _
        ["09",   "WebP Example09.au3",   "Create WebP animation from screen capture"], _
        ["10.1", "WebP Example10.1.au3", "Converts GIF animation to WebP animation"], _
        ["11",   "WebP Example11.au3",   "Display the differences of 2 WebP images (same dimension"], _
        ["12",   "WebP Example12.au3",   "Resize a WebP image"], _
        ["13",   "WebP Example13.au3",   "Estimate the quality of a WebP image"], _
        ["14.1", "WebP Example14.1.au3", "Play an animated WebP file on Desktop (separated thread)"], _
        ["15",   "WebP Example15.au3",   "Play an animated WebP file in GUI (separated thread)"], _
        ["16.1", "WebP Example16.1.au3", "Converts a PNG animation to a WebP animation"], _
        ["17",   "WebP Example17.au3",   "Re-encode a WebP image"], _
        ["18",   "WebP Example18.au3",   "Re-encode an animated WebP file"] ]

    $hGUI = GUICreate("UEZ WebP all examples", 400, 200)

    $idMenu = GUICtrlCreateMenu("Examples") ; create all menu items immediately after this line (+++)
    For $i = 0 To Ubound($aExample) - 1
        GUICtrlCreateMenuItem($aExample[$i][0] & @TAB & $aExample[$i][2], $idMenu, -1, 1) ; last param. 1 = create a menuradioitem
    Next

    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $idMenu + 1 To $idMenu + Ubound($aExample)
                $sFileName = @ScriptDir & "\" & $aExample[$nMsg - ($idMenu + 1)][1]
                If Not FileExists($sFileName) Then
                    Msgbox($MB_TOPMOST, "Script not found", $sFileName)
                Else
                    $iPID = Run(@AutoItExe & " /AutoIt3ExecuteScript " & chr(34) & $sFileName & chr(34)) ; chr(34) is "
                    If $iPID = 0 Then MsgBox($MB_TOPMOST, "Run issue : $iPID = 0 , @error = " & @error, $sFileName)
                EndIf
        EndSwitch
    WEnd

    GUIDelete($hGUI)
EndFunc   ;==>Example

;==============================================
Func _Doubleton($sTitle)

    If WinExists($sTitle) Then
        Local $iChoice = Msgbox(BitOr($MB_YESNO, $MB_DEFBUTTON2, $MB_ICONQUESTION, $MB_TOPMOST), $sTitle, _
            "This script is already running. Launch another instance ?")
        If $iChoice = $IDNO Then Return True
    EndIf
    AutoItWinSetTitle($sTitle) ; remember the AutoIt window is always hidden
EndFunc   ;==>_Doubleton

UEZWebPallexamples(181).png.eb5b56d5d816d6c4628d429e953277b2.png

Edited by pixelsearch
finished, all UEZ examples have been added to the menu

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted
7 hours ago, UEZ said:

I added WebP Example05.1.au3.

...so I added it to the menu, all your examples have been added just now (the script in preceding post has been updated)

"I think you are searching a bug where there is no bug... don't listen to bad advice."

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
×
×
  • Create New...