Nine Posted December 2, 2020 Author Share Posted December 2, 2020 Found another problem when all GIFs were deleted and new ones start being recreated. I needed to remove some logic out of the adlib function and store that logic in the delete function. And repeating AdLibRegister is also solved. “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...
pixelsearch Posted December 3, 2020 Share Posted December 3, 2020 (edited) Bravo Nine, it works fine now Good catch for disposing image(s) & graphic(s), not only when user quits the script, but also during the control deletion phase. When the script displays 1 gif only (index 0), ConsoleWrite(s) correctly show this : 1 gif : Quit after this gif has been deleted, then recreated ============================================================ Creating 0 AdlibRegister Deleting 0 Disposing 0 Adlib UnRegister Recreating 0 AdlibRegister QUIT : FINAL UnRegister QUIT : Disposing 0 Edited December 3, 2020 by pixelsearch typo Link to comment Share on other sites More sharing options...
Nine Posted December 20, 2020 Author Share Posted December 20, 2020 New version available. When GIF has frame delays set to 0, there was no time left for the message loop. Change 0 to a minimum delay of 5. “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...
Letraindusoir Posted February 19, 2021 Share Posted February 19, 2021 (edited) Very good UDF, it works very well., Thank Nine for your hard work! If can realize the image Zoom function further, as the web page shows the picture to Zoom (in or out) automatically according to the given Area(width and height). Or cut automatically so that the center of Gif is always at the center of a given area if so ,it will be more perfect #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "Cached GIF Animation.au3" Example() Func Example() GUICreate("GUI", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) GUISetBkColor(0xE0FFFF) Local $IMG_Ctrl = _GUICtrlCreateAnimGIF("9.gif", 10, 10, 330, 172, -1, $GUI_WS_EX_PARENTDRAG) Local $idButton_Close = GUICtrlCreateButton("close", 255, 190, 85, 25) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE,$idButton_Close ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example Edited February 19, 2021 by Letraindusoir mLipok 1 Link to comment Share on other sites More sharing options...
Nine Posted February 19, 2021 Author Share Posted February 19, 2021 @Letraindusoir Thanks. Glad you like it. I believe it could be possible to modify each frames by zoom, crop, resize or distord. BUT, I also think it may jeopardize the performance of the UDF, and erase the speed benefit gains with cached approach. By, transforming frame after frame repeatedly at high speed, I am afraid that the whole performance of UDF may suffer. So I suggest you use one of the free tools available over the web to modify your GIF exactly as you wish to have it prior to use the UDF. I have done it in the past successfully. “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...
pixelsearch Posted February 19, 2021 Share Posted February 19, 2021 9 hours ago, Nine said: ...one of the free tools available over the web to modify your GIF Eddie Kohler wrote a command-line utility named Gsicle, it's worth a try for resizing, cropping, merging animated gifs. But it sure needs you to read its documentation first, at least concerning the function(s) you wanna use. I used it in the past to merge some gifs and re-used it just now to crop or resize the gif uploaded by letraindusoir Link to comment Share on other sites More sharing options...
Letraindusoir Posted February 20, 2021 Share Posted February 20, 2021 (edited) Using third-party software to reduce Gif achieve the purpose of scaling Gif, although feasible, but still lack of convenience. How about a different way, for example, to mask or shade the parts of the GIF beyond a given area? As shown below, the lower right part of the Gif is masked or hidden because it is beyond a given area of the GUI. If the upper left part of the Gif can also be treated like this,if or not achieve the goal? Using the negative coordinates and subwindow can probably achieve this goal, but it feels a little inconvenient.... Edited February 20, 2021 by Letraindusoir Link to comment Share on other sites More sharing options...
Nine Posted February 20, 2021 Author Share Posted February 20, 2021 (edited) Try this : https://ezgif.com/resize Result : ps. it took me about 10 secs to achieve this crop... Edited February 20, 2021 by Nine “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...
pixelsearch Posted February 20, 2021 Share Posted February 20, 2021 (edited) Nice idea Letraindusoir. Cropping shouldn't be a problem using negative values, what follows works for me (using the original pic renamed letrain.gif) You just got to determine how much you want to crop : ; Local $IMG_Ctrl = _GUICtrlCreateAnimGIF("letrain.gif", 10, 10, 330, 172, -1, $GUI_WS_EX_PARENTDRAG) Local $IMG_Ctrl = _GUICtrlCreateAnimGIF("letrain.gif", -30, -90, 380, 192, -1, $GUI_WS_EX_PARENTDRAG) Edited February 20, 2021 by pixelsearch Added pic result Link to comment Share on other sites More sharing options...
pixelsearch Posted February 20, 2021 Share Posted February 20, 2021 (edited) The "problem" with my precedent pic is that it will always be placed at 0,0 in the GUI, which is maybe not what the user wants. If you want the pic to be placed at your exact coords (10,10 to 330,172) then you can create a child window having these exact coords, it's easy to script and the result looks fine : #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "Cached GIF Animation.au3" Example() Func Example() $hGUI = GUICreate("GUI", 350, 250, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_EX_COMPOSITED) GUISetBkColor(0xE0FFFF) $hGUI2 = GUICreate("", 330, 172, 10, 10, $WS_CHILD, -1, $hGUI) Local $IMG_Ctrl = _GUICtrlCreateAnimGIF("letrain.gif", -35, -90, 330 + 35, 172 + 90) GUISwitch($hGUI) Local $idButton_Close = GUICtrlCreateButton("close", 255, 190, 85, 25) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE,$idButton_Close ExitLoop EndSwitch WEnd GUIDelete() EndFunc ;==>Example Nine's way (cropping it online) is sure the quickest way to do it, but it's interesting to know that we can find a solution in pure AutoIt language... while using the original animated gif Edited February 20, 2021 by pixelsearch typo dmob 1 Link to comment Share on other sites More sharing options...
Qwerty212 Posted February 8, 2022 Share Posted February 8, 2022 Hi! I get this error when I try to run the example sketch included in the udf's zip: Quote warning: $GDIP_FRAMEDIMENSION_TIME: possibly used before declaration. $iNumberOfFrames = _GDIPlus_ImageGetFrameCount($hImage, $GDIP_FRAMEDIMENSION_TIME) Link to comment Share on other sites More sharing options...
Nine Posted February 8, 2022 Author Share Posted February 8, 2022 You must be using an old version of AutoIt, right ? Because it is a constant declared in the gdi+ udf. “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...
Qwerty212 Posted February 8, 2022 Share Posted February 8, 2022 Yep, my fault, sorry. 😅 I was using an old version. Great UDF, thanks again for sharing. Greets from Barcelona Link to comment Share on other sites More sharing options...
Nine Posted April 7, 2022 Author Share Posted April 7, 2022 New version available argumentum 1 “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...
ling3882688 Posted December 5, 2022 Share Posted December 5, 2022 (edited) Hello Nine,Glad to see that you added double buffering to this UDF,I tried many UDFs to creat a png button,all of them cause flickering except your UDF. But,there's something I still don‘t understand. What's wrong with this countdown gif, It is overlapping. Global $IMG_Ctrl1 = _GUICtrlCreateAnimGIF("1.gif", 150, 50, 285, 280, -1, $GUI_WS_EX_PARENTDRAG, False, 0 ) I tried to change the $nBackColor to 0,it works.But if there is a backgroud picture ,It is overlapping again. Animated GIF Multiple.rar Edited December 5, 2022 by ling3882688 Link to comment Share on other sites More sharing options...
Nine Posted December 5, 2022 Author Share Posted December 5, 2022 By specifying 0 as the background color (last parameter), there is no graphic clear between each frame, so it overlaps. “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...
ling3882688 Posted December 5, 2022 Share Posted December 5, 2022 (edited) How can I keep the Gif transparent and stop it overlaps when the background picture is not solid color? Edited December 5, 2022 by ling3882688 Link to comment Share on other sites More sharing options...
Nine Posted December 6, 2022 Author Share Posted December 6, 2022 No idea... “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...
ling3882688 Posted December 6, 2022 Share Posted December 6, 2022 (edited) Ok,Thanks😁 Perhaps,I need to creat another Gui, Then make it transparent on top of the first Gui.Many Gdi+ Gui did in this way. Edited December 6, 2022 by ling3882688 Link to comment Share on other sites More sharing options...
Nine Posted December 6, 2022 Author Share Posted December 6, 2022 (edited) @ling3882688 I have found a decent way to achieve it. Here the example using your background image and your GIF. #include <GUIConstants.au3> #include <GDIPlus.au3> #include "Cached GIF Animation.au3" OnAutoItExitRegister(_GIF_Animation_Quit) Local $hGUI = GUICreate("GIF Animation", 800, 600, -1, -1, $WS_POPUP, $WS_EX_CONTROLPARENT) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local $hOrig = _GDIPlus_ImageLoadFromFile("bg.png") Local $hImage = _GDIPlus_ImageResize($hOrig, 800, 600) _GDIPlus_ImageDispose($hOrig) GUISetState() _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, 800, 600) _GUICtrlCreateAnimGIF("9.gif", 150, 50, 285, 280, -1, -1, False, $hImage, True) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) Please test it with the new UDF. I'll update the first post after (done)... Edited December 6, 2022 by Nine Removed attachment. Refer to 1st post. pixelsearch 1 “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...
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