Mbee Posted June 6, 2016 Share Posted June 6, 2016 6 hours ago, junkew said: see Thanks for your reply, junkew. But I hope you'll forgive me if I say that your reply is terse in the extreme. I downloaded and looked at the code at that reply, and perhaps I'm just too stupid, but I can't see anything there relevant to my inquiry. For example, I need to call trancexx's "_GUICtrlCreateGIF()" function, but the code you provided makes no such calls. Perhaps you would be willing to share more words and explain to me what must be so obvious to you, please? Thanks! Link to comment Share on other sites More sharing options...
Gianni Posted June 6, 2016 Share Posted June 6, 2016 (edited) Hi @Mbee have you tried my example in post #151? in short you can: 1) transform your gif image to binary string using the following nice tool by mr. @wakillon. https://www.autoitscript.com/forum/topic/123329-binarytoau3kompressor-v1054-update-of-10-oct-2014/ 2) embedd (the needed part) of the generated code in your script 3) position and resize the images using the _GUICtrlCreateGIF() function created by the guru @trancexx here a simple example. hope it can help expandcollapse popup#include "GIFAnimation.au3" ; ----- following code generated using Wakillon's BinaryToAu3Kompressor ------ ; ----- https://www.autoitscript.com/forum/topic/123329-binarytoau3kompressor-v1054-update-of-10-oct-2014/ ; Guitarrist Global $sFileBin = '0xF0B200474946383961150000200083000000FFFF00734A00DC9200FFD4408E96620050320080FF000062966E6E6E00003096A0A0A40088090021FF000B4E4554534341504045322E3003010124FE000928432946756D6942650018F904090E00282C03015801C64304AD10C8090082A5180763CEF89B0011480551144091AC0049300485228F9916001CF48DD7DAEBD3BC00CAEBC0319C4EA0DA00B170C0E980C1A744001A9C0AAE5768559800DC563A9C90C805CB0014C809C429CC53A50057B06653CBBB8DA800552A3E1390CDA67E00747C588275571F0200857C1F8C8A14176400155A268F1D162F4500164B8F43451C675D003D30276A05638227002D2F09A66C4A2C0800644C73416E2BB372008E137615B45EBCBD003B79BE7B357ABE75001617C18ACACA53CE14191182600A89600304AC0010C849ABBD2068CC0083F80167791F285200E43008E12905032C00BBAF6AB734ACE2E700366F14420165301C006EC55641389C048C009A58D1A029589B4E0063721A0D609DB1C300B458D0F1C00131F900BABBC8AE082B15680029C712F14292634D00C8127A7B17050985007E31050A8A6713840085086F07928C128E0008855E92937C8680009A9B7C579369079400151AA519A01D9A2100A4A64EA0AF3DB2AB0018B3AAA922B8B8AC00BABD6E1A40AFA601008A8B2FC70A94C2C2282FCD671260A91F60A28000C170B80D79848AF000A0890D0DA110A1500040118F4FA88C5AAD00050ED9A72ED09DC800C059EE6E14E322B800050D4F9288C7126F00AE015348F865750500477C7E7F77050A0A0073137D7E08800507004C84787F54929317008D859198999A7092001AA22EA351A4419800A79F185F99AE8B4A00A8B03DB3A81DB6AC0017B419B7BB722DB000B1198989C1C58ABF30C02FC0737F2F6A2F9B64114B2F096475812F859293008B128D8505939F9A009B70995F943D5F5100993DA019AA41AEA500A166B0AE1DB4A6B600A6B1ABBAB517724000B1A10189892DC4C5E09AC0C1CB157F2FFF5EFF5E3FBF17BF17BF177F2F7F2F6B2F3B' Global $sFileBin1 = Binary(_LzntDecompress($sFileBin)) ; Fish $sFileBin = '0xA2B4004749463839612600502B00C3000100800218800F0230003800200000C0C0C0FFF10040FF00FF0218001C001000000021FF0B4E4554534300415045322E30030101003821F904011900020C002C019801AC870008001208000473080076FF080000FF2100FF2900FF310000FF3900FF4200FF004A00FF5200FF5A0000FF6300FF6B00FF730000FF7B00FF8400FFFE8C0362FF007F003F003F003F003F00033300C0BD05081C48B02000C101030C2A5CC8B00020C2840D234A14F00070A245830F115EDC0088B040010320356E008C380024C88F1F0D00401CA9B0A4C997260057B21C58F280019B00386FEA94C972C081009F40830AE579D1A700D0A343010008B0B400E1D2A708101C881A00752A55A951954ED800BAB569C1A55CBB0600B84AF62A80B0680100103C8B962B80B26500D9B69D1060A0DCB90074132048C0B72FDF00BB73EB0A0880976B0000BF8813006E5B97007061C389FF3E36EC00186D80CB861568DE00AC4031E5CA61315B0036BC350067CE6C2B00832EBD9A2E69BAA70037A77E1DBAB5EAD2000B72EBCE3DBB34E300D67445D3DDBD5BEE0065E08D2707204E1C00786881CE0D33984E00BD7AF4D203A307A800CE9DBAF682C2593300DD6830BE3CF9F30C00BE1B3C7EB981FBF100EEDFC77F1F3E38C30001F3F3EBD7CF5EF000FD060EB817608000001668E0800212D59200030C36D860034A2900E5E0840A2A44C084000D2E751C00183A5000A1850F3018A20321006A781C892232F8A10041043CE0E28B0F9800C81E8C2EAE48C08D0038B648A38CC7D19800514604E5882304440042F000043C5E56E400913F563490900210005064914906302504001035F9E48D075D5900E5942B692910970700450041046822D91F009A69CAF4234966B200C9239B11AC28D10000744660229D764E8400670412001AA8048300F669119E84269AA800A1450DA0A80422CDC0D4D09B1B05043F9E3F9EFF3F9E1F001F001F001F001F001F001F00FF1F001F001F001F001F001F001F001F00FF1F001F001F000F000F000F000F001F4FFF1F4F1F4F1F4F1F4F1F4F1F4F1F4F1F4FBF1F4F1F4F1F4F1F4F1F4F134FDE1F4F031F4F1D4F81043AE8A082000A1120E183100A080060831456F800831F00329821820D84F84000870611F0C08A2C6A0038E2872CA248C08C0034AAC8E287230A78006346191154238D10000419648E040A7922008F2209F4A30004080029A4525042E9240400102139108D074D090040840002E0E44A56002A498043114010C10099101CD8C09968CA00C4234965B249A203006C4680A24403D49900E19A67DE39519E1100482041A0820E2A81009F16E56968A18222005AD4008C1EEAE848006F6E14100021FE89005468697320616E69406D617465642050A4200066696C65207761730020636F6E73747275026381017573696E672050556C656143024112036F007220547269616C200056657273696F6E2C40207669736974D0022000617420687474703A802F2F7777772E758103802E636F6D20746F0006006E64206F7574206D006F72652E015553532050434D540040A8504918414E59E00540A849312E0067696602433A5C6100786F6F6D6E6577650073745C6772617068906963735CD20101323F02033802D2010101003B' Global $sFileBin2 = Binary(_LzntDecompress($sFileBin)) Func _LzntDecompress($bBinary); by trancexx $bBinary = Binary($bBinary) Local $tInput = DllStructCreate('byte[' & BinaryLen($bBinary) & ']') DllStructSetData($tInput, 1, $bBinary) Local $tBuffer = DllStructCreate('byte[' & 16 * DllStructGetSize($tInput) & ']') Local $a_Call = DllCall('ntdll.dll', 'int', 'RtlDecompressBuffer', 'ushort', 2, 'ptr', DllStructGetPtr($tBuffer), 'dword', DllStructGetSize($tBuffer), 'ptr', DllStructGetPtr($tInput), 'dword', DllStructGetSize($tInput), 'dword*', 0) If @error Or $a_Call[0] Then Return SetError(1, 0, '') Local $tOutput = DllStructCreate('byte[' & $a_Call[6] & ']', DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>_LzntDecompress ; ------ end of Decompression ------------------------------------------------ Opt("GUICloseOnESC", 1); ESC to exit Opt("MustDeclareVars", 1) ; Make GUI Global $hGui = GUICreate("GIF Animation", 450, 350) ; GIF job ; _GUICtrlCreateGIF( BinFile, "", xPosition, yPosition, xWidth, yHeight) ; Gutarrist _GUICtrlCreateGIF($sFileBin1, "", 5, 5, 35, 35) _GUICtrlCreateGIF($sFileBin1, "", 80, 80, 55, 55) _GUICtrlCreateGIF($sFileBin1, "", 90, 170, 155, 155) GUICtrlSetTip(-1, "ESC to exit") ; Fish _GUICtrlCreateGIF($sFileBin2, "", 55, 5, 35, 35) _GUICtrlCreateGIF($sFileBin2, "", 180, 80, 55, 55) _GUICtrlCreateGIF($sFileBin2, "", 270, 170, 155, 155) GUICtrlSetTip(-1, "ESC to exit") ; Show it GUISetState() ; Loop till end While 1 If GUIGetMsg() = -3 Then Exit WEnd Edited June 6, 2016 by Chimp argumentum 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Mbee Posted June 10, 2016 Share Posted June 10, 2016 For Chimp and others who have been following this sub-discussion in this thread, that particular issue has been resolved. Please see my response to Chimp at https://www.autoitscript.com/forum/topic/182919-can-anyone-help-me-with-trancexxs-gifanimation-udf/?do=findComment&comment=1313888 But I will post a new question here in this thread in a moment... Link to comment Share on other sites More sharing options...
Mbee Posted June 10, 2016 Share Posted June 10, 2016 Why won't my animated GIFs animate? Using trancexx's UDF, I've been able to display any supported image type except for animated GIFs! Instead, when I try, it displays the first frame only. Part of the problem may possibly relate to the fact that my GUI uses Event Mode instead of Message Mode (all of trancexx's examples use Message Mode), but I don't think so. I think my issue somehow relates to the fact that in trancexx's examples, somehow to animation plays "behind the scenes" in the very complex and very hard to understand internal UDF functions (the non-public ones). I suggest that because calling the public function _GIF_ResumeAnimation() and the like do not make any difference; no animation plays. Can anyone familiar with the internal code of trancexx's (I wish I knew which pronoun to use: hers or his?) UDF help me out, please? Thanks! Link to comment Share on other sites More sharing options...
Mbee Posted June 10, 2016 Share Posted June 10, 2016 Sigh... I've finally determined from reading trancexx's UDF that it cannot possibly support Animated Gifs in Event Mode as written (dammit!) The internal code sends messages all over the place -- the full implications of which went unrealized until now (stupid me!) So for now, I have to extensively re-write my GUI to use old-fashioned amd extra-ugly Message Loops instead of Event Mode. Bummer... . . . By the way... WANTED: An Animated GIF UDF that is compatible with Event Mode Oh, well... Link to comment Share on other sites More sharing options...
trancexx Posted June 10, 2016 Author Share Posted June 10, 2016 There shouldn't be problems with onevent mode. If there's no animation then something else isn't right. What's your system? "Her" is about right. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Mbee Posted June 10, 2016 Share Posted June 10, 2016 (edited) 44 minutes ago, trancexx said: There shouldn't be problems with onevent mode. If there's no animation then something else isn't right. What's your system? "Her" is about right. Oh, great and wise goddess trancexx! Forgive me my rude pronoun question! I know that can get complicated, and I shouldn't have pried... More to the point: Thank you, thank you! for checking in and replying! I hope my little love offering was at least minimally acceptable... To answer your question, I'm running 64-bit Win 7 SP1 (but will update to WinX before too long), with the latest release of AutoIt. I went ahead and re-wrote my GUI app for Message Loop mode (it wasn't as bad as I thought to do that). But let me explain why I thought I had to do that (i.e., why I thought my animation failure was due to Event Mode): In your Example6_ImageViewer.au3 you provided with GIFAnimation_2.1.2, that example shows the following lines of code: GUIRegisterMsg(5, "_AdjustGIFPos") ; WM_SIZE GUIRegisterMsg(15, "_ValidateGIFs"); WM_PAINT GUIRegisterMsg(36, "_SetMinMax") ; WM_GETMINMAXINFO In my admittedly limited knowledge and experience, I was informed that you could not call GUIRegisterMsg for an Event Mode GUI, but only in Message Loop mode. Is that incorrect? At any rate, I've already converted to Message Loop with those lines (slightly modified to match my own naming conventions) and copied the registered functions's code virtually verbatim from Example 6. Even after that (i.e., as of now), animated GIFs still will not animate. In the immediately previous version I had to convert the _GUICtrlCreateGIF() control ID returned into a global handle for those functions copied from the bottom of Example 6, but even after fixing that I still see no animation. I'd be more than willing to post or email whatever code you'd like to see (I suggested email only if you wanted to see more than could comfortably be posted here on the forum); just tell me what you'd like to see. But to start with, here are my slightly modified versions of the three functions from Example 6 under discussion (and frankly, I can barely begin to understand that code)... expandcollapse popupGlobal $G_ClientSizeAra, $G_GIFDimensionAra, $G_AniGifPosX, $G_AniGifPosY, $G_GIFhdl ; Required for GIFAnimation UDF usage ... Func _AdjustGIFPos($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $G_ClientSizeAra[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] $G_AniGifPosX = ($G_ClientSizeAra[0] - $G_GIFDimensionAra[0]) / 2 $G_AniGifPosY = ($G_ClientSizeAra[1] - $G_GIFDimensionAra[1]) / 2 - 100 If $G_AniGifPosY < 0 Then $G_AniGifPosY = 0 If $G_AniGifPosY + $G_GIFDimensionAra[1] > $G_ClientSizeAra[1] - 100 Then $G_AniGifPosY -= $G_GIFDimensionAra[1] - $G_ClientSizeAra[1] + 100 ; not to cover buttons GUICtrlSetPos($G_GIFhdl, $G_AniGifPosX, $G_AniGifPosY, $G_GIFDimensionAra[0], $G_GIFDimensionAra[1]) EndFunc ;==>_AdjustGIFPos ; ; = = = = ; Func _ValidateGIFs($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GIF_ValidateGIF($G_GIFhdl) EndFunc ;==>_ValidateGIFs ; ; = = = = ; Func _SetMinMax($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam If $hWnd = $PicDistributorGUI Then Local $tMINMAXINFO = DllStructCreate("int[2];" & _ "int MaxSize[2];" & _ "int MaxPosition[2];" & _ "int MinTrackSize[2];" & _ "int MaxTrackSize[2]", _ $lParam) DllStructSetData($tMINMAXINFO, "MinTrackSize", 500, 1) DllStructSetData($tMINMAXINFO, "MinTrackSize", 350, 2) EndIf EndFunc ;==>_SetMinMax ; Once again, thanks so extremely much for helping me out! Edited June 10, 2016 by Mbee Typos Link to comment Share on other sites More sharing options...
Mbee Posted June 10, 2016 Share Posted June 10, 2016 I hope this doesn't get double-posted! Anyway, here's a slight revision to the code snippet I posted above (I didn't need to declare the ClientSizeArray as a Global): expandcollapse popupGlobal $G_GIFDimensionAra, $G_AniGifPosX, $G_AniGifPosY, $G_GIFhdl ; Required for GIFAnimation UDF usage ... Func _MyAdjustGIFPos($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $L_ClientSizeAra[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] $G_AniGifPosX = ($L_ClientSizeAra[0] - $G_GIFDimensionAra[0]) / 2 $G_AniGifPosY = ($L_ClientSizeAra[1] - $G_GIFDimensionAra[1]) / 2 - 100 If $G_AniGifPosY < 0 Then $G_AniGifPosY = 0 If $G_AniGifPosY + $G_GIFDimensionAra[1] > $L_ClientSizeAra[1] - 100 Then $G_AniGifPosY -= $G_GIFDimensionAra[1] - $L_ClientSizeAra[1] + 100 ; not to cover buttons GUICtrlSetPos($G_GIFhdl, $G_AniGifPosX, $G_AniGifPosY, $G_GIFDimensionAra[0], $G_GIFDimensionAra[1]) EndFunc ;==>_MyAdjustGIFPos ; ; = = = = ; Func _MyValidateGIFs($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GIF_ValidateGIF($G_GIFhdl) EndFunc ;==>_MyValidateGIFs ; ; = = = = ; Func _MySetMinMax($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam If $hWnd = $PicDistributorGUI Then Local $tMINMAXINFO = DllStructCreate("int[2];" & _ "int MaxSize[2];" & _ "int MaxPosition[2];" & _ "int MinTrackSize[2];" & _ "int MaxTrackSize[2]", _ $lParam) DllStructSetData($tMINMAXINFO, "MinTrackSize", 500, 1) DllStructSetData($tMINMAXINFO, "MinTrackSize", 350, 2) EndIf EndFunc ;==>_MySetMinMax ; Link to comment Share on other sites More sharing options...
trancexx Posted June 11, 2016 Author Share Posted June 11, 2016 Can we start from the beginning. I might have missed something. Does any of the examples that go with the UDF work for you? Do you have animation with them, out of the box? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Mbee Posted June 11, 2016 Share Posted June 11, 2016 Hi, trancexx! I didn't hear the notification of a response, which explains the delay in responding... To answer your questions, yes the examples work perfectly, including for animated GIFs. But it's my adaptation that has problems... Okay, from the beginning: I'm developing a GUI app where one main feature is largely gratefully borrowed from "Example6_ImageViewer.au3" from your GIFAnimation_2.1.2 UDF. I had difficulty for a while trying to figure out how to pass a binary image for the first argument instead of a file path, but I eventually figured out that I simply need to pass the full contents of a binary FileRead() of the image file. I've got my GUI app pretty far along. It displays every kind of allowed image file perfectly, except for animated GIFs. All they show is the first frame and it never animates. And I've struggled for so long with this that I'm stumped. As I said above, I'll post any part of my code you'd like. What I posted in #168, above, represented a guess as to where the problem might lie, because those three functions (_AdjustGIFPos, _ValidateGIFs, and _SetMinMax), which I copied virtually verbatim from Example 6, are quite inexplicable to me. How important are they for playing animated GIFs? If they're not involved in the animation, then the problem must lie elsewhere. What my code does is read in an image file in binary, re-size/re-scale it to exactly fit the dimensions and position I want on the GUI, then call your _GUICtrlCreateGIF() function of the UDF. Here's the call... $L_GifCtlID = _GUICtrlCreateGIF( $G_BinaryPicData, Default, $L_DispXpos, $L_DispYpos, _ $Lf_PicWidth, $Lf_PicHeight ) I get no error returns anywhere in my code, and every other type of image is displayed perfectly other than animated GIFs. So, being stumped as I am, I'mextremely eager for your assistance! As an aside, would it be okay for me to email you regarding AutoIt code issues? I won't PM you (I know how much that is frowned upon), but I'd nevertheless like to contact you (no personal questions or anything like that! Just AutoIt coding help). Link to comment Share on other sites More sharing options...
meoit Posted November 27, 2016 Share Posted November 27, 2016 Hi @trancexx ! How to play gif animation in Memory or Binary ?. Thanks. Link to comment Share on other sites More sharing options...
trancexx Posted November 27, 2016 Author Share Posted November 27, 2016 3 hours ago, meoit said: Hi @trancexx ! How to play gif animation in Memory or Binary ?. Thanks. Pass binary to the function _GUICtrlCreateGIF($bBinary, "", ... meoit 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
rcostin Posted December 19, 2016 Share Posted December 19, 2016 Hi to all! how to add text over gif? p.s. full screen gif thx Link to comment Share on other sites More sharing options...
Mbee Posted December 20, 2016 Share Posted December 20, 2016 On 12/19/2016 at 1:40 PM, rcostin said: Hi to all! how to add text over gif? p.s. full screen gif thx Hello, rcostin, and welcome to the forum! This UDF does not directly support that capability. You will have to independently produce a new gif file that includes the text overlay you desire, and then play the newly created file. Good luck. rcostin 1 Link to comment Share on other sites More sharing options...
Glukovich Posted January 4, 2017 Share Posted January 4, 2017 Hi all. Give me an advice please... I need to do some analyze of bitmaps of each frame in GIF image. How can I use this UDF for getting bitmaps of GIF images frame by frame? I find this UDF very powerful in reading GIFs, but I haven't enough knowledge for changing it to my purposes. Every google search brings me in this topic... I was looking into _GIF_RefreshGIF function, and then in _GIF_ImageList_DrawEx, but then I stuck. Thank you. Link to comment Share on other sites More sharing options...
trancexx Posted January 5, 2017 Author Share Posted January 5, 2017 On 4.1.2017. at 3:17 AM, Glukovich said: Hi all. Give me an advice please... I need to do some analyze of bitmaps of each frame in GIF image. How can I use this UDF for getting bitmaps of GIF images frame by frame? I find this UDF very powerful in reading GIFs, but I haven't enough knowledge for changing it to my purposes. Every google search brings me in this topic... I was looking into _GIF_RefreshGIF function, and then in _GIF_ImageList_DrawEx, but then I stuck. Thank you. Search for use of _GIF_GdipImageSelectActiveFrame() inside the UDF. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
SCodeGermany Posted October 9, 2018 Share Posted October 9, 2018 W0W you're my hero! Thank you! Link to comment Share on other sites More sharing options...
borsTiHD Posted February 16, 2019 Share Posted February 16, 2019 Hey trancexx, I just wanted to thank you a thousand times for this UDF. This is really amazing. Using it for longer JSON/API request to have a loading animation. Before, I only had a label control, running different strings through it ("/", "-", "\", "|") in my main loop. Link to comment Share on other sites More sharing options...
saraconor Posted August 8, 2019 Share Posted August 8, 2019 How to make GIF behind buttons and labels ? Link to comment Share on other sites More sharing options...
edumanilha Posted March 12, 2020 Share Posted March 12, 2020 Hi, how can I make a borderless animated gif GUI? I tried some things on your examples without success...Thank you! 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