UEZ Posted May 31, 2023 Share Posted May 31, 2023 @Belinimaybe you have adjust the path to the images. Just debug to console in the load loop in line 13 to see if handle is created. ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hImage = ' & $hImage & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Tested on Win11. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Belini Posted May 31, 2023 Author Share Posted May 31, 2023 (edited) Now it worked but it doesn't occupy all desktop as i need it, the gui is being created in the dimensions of the image and i need the gui and the image to be the same size as the desktop. Global Const $hGUI = GUICreate("Test", @DesktopWidth, @DesktopHeight, $WS_POPUP) The image just occupies the whole desktop using _GDIPlus_ImageResize() but then the cpu usage gets very high. Edited May 31, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Solution UEZ Posted May 31, 2023 Solution Share Posted May 31, 2023 I added in the main loop a line to resize the image _WinAPI_StretchBlt: ;_WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $SRCCOPY) _WinAPI_StretchBlt($hDC, 0, 0, @DesktopWidth, @DesktopHeight, $hGfxDC, 0, 0, $iW, $iH, $SRCCOPY) ;resize This should stretch the image to your desktop. Btw, what is your CPU load now with my example? Belini 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
pixelsearch Posted May 31, 2023 Share Posted May 31, 2023 @UEZ Glad to have you back on the Forum Link to comment Share on other sites More sharing options...
Belini Posted May 31, 2023 Author Share Posted May 31, 2023 (edited) Amazing @UEZ 0% to 1% cpu usage now, thanks for helping to solve this problem. EDITED: How would it look in your example to search for images on disk instead of saving them in memory? Edited May 31, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
UEZ Posted May 31, 2023 Share Posted May 31, 2023 35 minutes ago, pixelsearch said: @UEZ Glad to have you back on the Forum I took a "short" break. 😉 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
UEZ Posted May 31, 2023 Share Posted May 31, 2023 (edited) 45 minutes ago, Belini said: Amazing @UEZ 0% to 1% cpu usage now, thanks for helping to solve this problem. EDITED: How would it look in your example to search for images on disk instead of saving them in memory? For sure the CPU / HDD usage will increase. My CPU usage is ~1-5% but memory consumption is ~15 mb now. expandcollapse popup;Coded by UEZ build 2023-05-31 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> AutoItSetOption("GUIOnEventMode", 1) _GDIPlus_Startup() Global $i, $hImage, $hGDIBitmap, $hObjOld, $bExit = False Global Const $hGUI = GUICreate("Test", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetState() Global Const $hDC = _WinAPI_GetDC($hGUI), _ $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $i = 1 Do $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test\" & $i & ".jpg") $i += 1 If $i > 169 Then $i = 1 $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) $hObjOld = _WinAPI_SelectObject($hGfxDC, $hGDIBitmap) _WinAPI_StretchBlt($hDC, 0, 0, @DesktopWidth, @DesktopHeight, $hGfxDC, 0, 0, 1280, 720, $SRCCOPY) ;resize _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_DeleteObject($hGDIBitmap) If $bExit Then ExitLoop Until Not Sleep(10) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hGfxDC) _GDIPlus_Shutdown() Func _Exit() $bExit = True EndFunc Edited May 31, 2023 by UEZ Danyfirex and Zedna 2 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Belini Posted May 31, 2023 Author Share Posted May 31, 2023 (edited) @UEZ perfect now around ~10 - 15% of the cpu but it has greatly reduced memory usage, thank you very much for your help. Edited May 31, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
UEZ Posted May 31, 2023 Share Posted May 31, 2023 13 minutes ago, Belini said: @UEZ perfect now around ~10 - 15% of the cpu but it has greatly reduced memory usage, thank you very much for your help. You are welcome. You can play with the Sleep value to reduce CPU usage, for example set it to Sleep(30). The CPU usage should be decreased but also the animation speed. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Nine Posted May 31, 2023 Share Posted May 31, 2023 @UEZ Impressive work there. I gonna keep the example in my library... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Belini Posted June 7, 2023 Author Share Posted June 7, 2023 (edited) Player output using .jpg images with GDI: 15 images per second with a 50 millisecond interval between images. Edited June 7, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted June 14, 2023 Author Share Posted June 14, 2023 I'm finding the images not very clear as if they were in 16 bits, there is a way to improve the images by setting them to be shown in 24 bits, the images were extracted in 1280x720 and in 24 bits but it seems to lose quality when displayed. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted June 15, 2023 Author Share Posted June 15, 2023 Does anyone have any tips for improving the image that is displayed on the screen? My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Andreik Posted June 15, 2023 Share Posted June 15, 2023 I stand my previous position and I'm saying it again: you are doing it wrong and in wrong programming language. Switching image files and expecting to be like a video file playing it's just wrong (not to say it's kinda stupid) so if you really want to go on that way probably you won't find much support since people don't really like to spend time improving such an obvious wrong implementation. It's just my position, so don't be offended. I hope you will eventually find someone to help finish your project. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Belini Posted June 15, 2023 Author Share Posted June 15, 2023 (edited) @Andreik I am not offended but I reinforce that I really need the image player because sometimes I need two players at the same time, one to play background video and the other to play cdg which is very heavy and most of the time does not support opening two at the same time being able to control both separately and if I can't improve the image quality using GDI then I'll have to look for another way to display images as if it were a video. EDIT: I wanted to try with sdl2.dll, does anyone have an example of how to use sdl2.dll to display images? Edited June 15, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
UEZ Posted June 16, 2023 Share Posted June 16, 2023 @Belini: you can use _WinAPI_SetStretchBltMode($hDC, $STRETCH_HALFTONE) _WinAPI_SetBrushOrg($hDC, 0, 0) to produces higher quality images but this mode is slower and requires more processing of the source image. I personally don't see any improvement of the images, only higher CPU usage and slower execution. Anyhow, here the code: expandcollapse popup;Coded by UEZ build 2023-06-16 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> AutoItSetOption("GUIOnEventMode", 1) _GDIPlus_Startup() Global $i, $hImage, $hGDIBitmap, $hObjOld, $bExit = False Global Const $hGUI = GUICreate("Test", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetState() Global Const $hDC = _WinAPI_GetDC($hGUI), _ $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SetStretchBltMode($hDC, $STRETCH_HALFTONE) _WinAPI_SetBrushOrg($hDC, 0, 0) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $i = 1 Do $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test\" & $i & ".jpg") $i += 1 If $i > 169 Then $i = 1 $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) $hObjOld = _WinAPI_SelectObject($hGfxDC, $hGDIBitmap) _WinAPI_StretchBlt($hDC, 0, 0, @DesktopWidth, @DesktopHeight, $hGfxDC, 0, 0, 1280, 720, $SRCCOPY) ;resize _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_DeleteObject($hGDIBitmap) If $bExit Then ExitLoop Until Not Sleep(10) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hGfxDC) _GDIPlus_Shutdown() Func _Exit() $bExit = True EndFunc 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Belini Posted June 17, 2023 Author Share Posted June 17, 2023 @UEZ is really much slower using these options and it won't compensate for the little gain in image quality, thanks for helping once again. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now