Jump to content

Recommended Posts

Posted (edited)

@UEZ very nice !
In your example1, I tried to save the WebP in a jpg format, just after the WebP image was displayed inside the GUI. To do so, I added 3 lines to the script (they're commented below)

...
GUISetState()

; Global $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
; _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\WebP_to_jpg.jpg")
; _GDIPlus_ImageDispose($hImage)

_WinAPI_DeleteObject($hBitmap)
...

If you think something is wrong with these 3 lines, please be kind to indicate what needs to be changed.
Thank you :)

Edit: any idea why the content of these 2 functions is exactly the same ?
_GDIPlus_BitmapDispose()
_GDIPlus_ImageDispose()

Edited by pixelsearch

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

Posted

@pixelsearchthere is a problem with GDIPlus image which will be created inside the DLL and returned from the function. Oddly enough, I can create a GDI bitmap from this bitmap inside the DLL, but the bitmap doesn't work with the GDIPlus functions outside - I'm working on it.

 

2 hours ago, pixelsearch said:

_GDIPlus_BitmapDispose()
_GDIPlus_ImageDispose()

There is no difference, just the function name. GdipDisposeImage is for both - bitmaps and images.

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.2.0 build 2022-04-21 beta
Posted (edited)

I fixed the issue inside the DLL - there was an issue with GdipCreateBitmapFromScan0 referring to the pointer of an array of bytes that contains the pixel data.

I updated the DLLs -> download the 7Z archive from post #1

Thanks for testing.

You can use also

Global Const $hImage = WebP_BitmapCreateGDIp($sFile)

to get the GDI+ image which you can save using _GDIPlus_ImageSaveToFile.

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

  • UEZ changed the title to WebP v0.2.5 build 2022-04-30 beta
Posted

New version: added "simple" compression functions for lossless and lossy encoding -> see post #1. Advanced version will come later...

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.3.0 build 2022-05-07 beta
Posted

New version: added advanced compression functions for lossless and lossy encoding and WebP Advanced Encoder GUI -> see post #1

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.3.1 build 2022-06-15 beta
Posted (edited)

Updated DLL and WebP Advanced Encoder GUI code.

If you are interested, have a look to the post #1 for download link. 

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

  • UEZ changed the title to WebP v0.3.1 build 2022-06-18 beta
  • 2 years later...
Posted

Try this:

Example1.au3

;Coded by UEZ
#AutoIt3Wrapper_UseX64=y
#include <GUIConstantsEx.au3>
#include "WebP.au3"

;~ Global $sFile
Global $sFile = FileOpenDialog("Select an image", "", "Images (*.webp)")
If @error Then Exit

Global Const $STM_SETIMAGE = 0x0172
_GDIPlus_Startup()
Global Const $hImage = WebP_BitmapCreateGDIp($sFile)    ;load webp image as gdiplus
Global Const $hImage_Scaled = _GDIPlus_ImageScale($hImage, 0.5, 0.5) ;shrink image to 50%
Global Const $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_Scaled) ;convert gdiplus image to gdi image
_GDIPlus_ImageDispose($hImage_Scaled) ;dispose gdiplus image
_GDIPlus_ImageDispose($hImage) ;dispose gdiplus image

;get image dimension from gdi image
Global $tDim = DllStructCreate($tagBITMAP)
DllCall("gdi32.dll", "int", "GetObject", "int", $hBitmap, "int", DllStructGetSize($tDim), "ptr", DllStructGetPtr($tDim))
Global Const $iW = DllStructGetData($tDim, "bmWidth"), $iH = DllStructGetData($tDim, "bmHeight")
;display shrinked image in GUI
Global Const $hGUI = GUICreate("WebP Image Viewer", $iW, $iH)
GUISetBkColor(0xFFFFFF)
Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW - 1, $iH - 1)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap))
GUISetState()
_WinAPI_DeleteObject($hBitmap) ;dispose gdi image
_GDIPlus_Shutdown()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

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
3 minutes ago, UEZ said:

Try this:

Example1.au3

;Coded by UEZ
#AutoIt3Wrapper_UseX64=y
#include <GUIConstantsEx.au3>
#include "WebP.au3"

;~ Global $sFile
Global $sFile = FileOpenDialog("Select an image", "", "Images (*.webp)")
If @error Then Exit

Global Const $STM_SETIMAGE = 0x0172
_GDIPlus_Startup()
Global Const $hImage = WebP_BitmapCreateGDIp($sFile)    ;load webp image as gdiplus
Global Const $hImage_Scaled = _GDIPlus_ImageScale($hImage, 0.5, 0.5) ;shrink image to 50%
Global Const $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage_Scaled) ;convert gdiplus image to gdi image
_GDIPlus_ImageDispose($hImage_Scaled) ;dispose gdiplus image
_GDIPlus_ImageDispose($hImage) ;dispose gdiplus image

;get image dimension from gdi image
Global $tDim = DllStructCreate($tagBITMAP)
DllCall("gdi32.dll", "int", "GetObject", "int", $hBitmap, "int", DllStructGetSize($tDim), "ptr", DllStructGetPtr($tDim))
Global Const $iW = DllStructGetData($tDim, "bmWidth"), $iH = DllStructGetData($tDim, "bmHeight")
;display shrinked image in GUI
Global Const $hGUI = GUICreate("WebP Image Viewer", $iW, $iH)
GUISetBkColor(0xFFFFFF)
Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW - 1, $iH - 1)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap))
GUISetState()
_WinAPI_DeleteObject($hBitmap) ;dispose gdi image
_GDIPlus_Shutdown()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

Thanks but also showing full screen i want to change the image size to fit in gui width 1000 and 562. I will try _GDIPlus_ImageScale Function. Thanks a lot.

  • UEZ changed the title to WebP v0.3.3 build 2025-06-04 beta
Posted

Update to: WebP v0.3.3 build 2025-06-04 beta

Updated WebP x64 dll to latest version

Added decoding code for animated WebP files for boths DLLs -> see Example6 and Example7

 

See first post for download link.

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.3.3 build 2025-06-05 beta
  • 3 weeks later...
Posted

Updated to: WebP v0.3.5 build 2025-06-27 beta

You can now create WebP animated files.

Examples8 encodes GDI+ supported image files to an animation.

Example9 captures the desktop screen to an WebP anim file.

 

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.3.5 build 2025-06-27 beta
Posted

Hello @UEZ
Just downloaded all your files (including the Frames subfolder containing 10 png files to create the animation). Somes files were updated 3 hours ago, lucky me to download the brand new release just now :)

Example 8 worked fine and the created animation "TestAnim.webp" displayed without any issue.
Well done :thumbsup:

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

Posted

@pixelsearch thanks for testing. Is Example9 working?

Currently I'm trying to figure out how the callback is working but no real examples.

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
2 hours ago, UEZ said:

Is Example9 working?

Yes it is working. The 10s output file "Captured.webp" displays in the GUI, then loops until we close the GUI. It displays same in IrfanView.

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

  • UEZ changed the title to WebP v0.3.5 build 2025-06-30 beta
Posted

Great news as progress callback didn't show at all in the console (dll x86) even after I replaced at 3 different places in WebP.au3

"ptr", @AutoItX64 ? $pCallback : 0)[0]

with

"ptr", $pCallback)[0]

If not mistaken, all Console output lines come from the script (WebP Example9.au3) except this line displayed in Console by the dll :

Starting...done!

I'm gonna check your download site for the updated version including progress. No need to hurry, just take all the time you need to have it work nicely. Thanks a lot for this great script :)

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

Posted (edited)

Yes, I forgot to removed these lines for the other functions but I need to add the code also for the other function with callbacks.

 

Currently only function "WebP_CreateWebPCreateAnimFromScreenCapture" in the dll is implemented (example 9) for callback but it should be easy to add also for the other functions.

 

I think tomorrow I will add it to the other functions, too.

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

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