Felix. 0 Posted December 22, 2021 Subject says it all. How to create an animated gif from a set of bitmaps? (Firemonkey) Thank you Share this post Link to post
Remy Lebeau 1435 Posted December 22, 2021 AFAIK FireMonkey doesn't support animated GIFs. Use an 3rd party image library that does. Share this post Link to post
Anders Melander 1815 Posted December 22, 2021 1 hour ago, Remy Lebeau said: AFAIK FireMonkey doesn't support animated GIFs. Use an 3rd party image library that does. Doesn't TGIFImage (the non-visual part) work with FireMonkey? Share this post Link to post
Felix. 0 Posted December 23, 2021 5 hours ago, Remy Lebeau said: AFAIK FireMonkey doesn't support animated GIFs. Use an 3rd party image library that does. I don't need to view or play GIFs. I just need to create an animated GIF from a set of bitmaps. Share this post Link to post
Anders Melander 1815 Posted December 23, 2021 5 hours ago, Felix. said: I don't need to view or play GIFs. I just need to create an animated GIF from a set of bitmaps. Try this: procedure MakeGIF(Bitmap1, Bitmap2, Bitmap3: TBitmap); var GIF: TGIFImage; Frame: TGIFFrame; GCExt: TGIFGraphicControlExtension; LoopExt: TGIFAppExtNSLoop; begin GIF := TGIFImage.Create; try Frame := GIF.Add(Bitmap1); // Netscape Loop extension must be the first extension in the first frame! LoopExt := TGIFAppExtNSLoop.Create(Frame); LoopExt.Loops := 0; // Number of loops (0 = forever) // Add Graphic Control Extension GCExt := TGIFGraphicControlExtension.Create(Frame); GCExt.Delay := 30; // Animation delay (30 = 300 mS) Frame := GIF.Add(Bitmap2); GCExt := TGIFGraphicControlExtension.Create(Frame); GCExt.Delay := 30; Frame := GIF.Add(Bitmap3); GCExt := TGIFGraphicControlExtension.Create(Frame); GCExt.Delay := 30; GIF.OptimizeColorMap; GIF.Optimize([ooMerge, ooCrop], rmNone, dmNearest, 0); GIF.SaveToFile('foobar.gif'); finally GIF.Free; end; end; This is just from (my) memory so I'm not sure if it compiles. It's been a while since I wrote that thing. You should be able to find plenty of examples if you search for TGIFImage. 1 Share this post Link to post
Felix. 0 Posted December 23, 2021 2 hours ago, Anders Melander said: Try this: This is just from (my) memory so I'm not sure if it compiles. It's been a while since I wrote that thing. You should be able to find plenty of examples if you search for TGIFImage. Thank you, your memory is great. I'll try it today Share this post Link to post
Remy Lebeau 1435 Posted December 23, 2021 (edited) 17 hours ago, Anders Melander said: Doesn't TGIFImage (the non-visual part) work with FireMonkey? TGIFImage is a VCL class, AFAIK it is not available in FMX. Also, as I don't use FMX myself, my claim about its lack of support for animated GIFs is mainly based on the below post, which presents some 3rd party solutions for displaying animated GIFs in an FMX UI: https://stackoverflow.com/questions/45285599/how-to-use-animated-gif-in-firemonkey For displaying a series of bitmaps in a UI, one can use TBitmapListAnimation, but I don't know if that can also be used to create a GIF. Embarcadero's documentation only mentions that FMX's TBitmap supports GIF on all platforms except iOS, but doesn't mention what kinds of GIFs are supported. Edited December 23, 2021 by Remy Lebeau 1 Share this post Link to post
Anders Melander 1815 Posted December 23, 2021 Ah yes, TGraphic is a VCL class. I forgot that. I don't use FMX either and I knew FMX couldn't use TGIFImage for display (since that requires TPicture/TImage) but I would have thought one could still use the non-visual stuff such as load/save and GIF manipulation. I guess not. Share this post Link to post
Felix. 0 Posted December 26, 2021 On 12/23/2021 at 3:22 AM, Remy Lebeau said: AFAIK FireMonkey doesn't support animated GIFs. Use an 3rd party image library that does. Which one would you recommend for Firemonkey? Share this post Link to post
kabiri 3 Posted January 26, 2023 This question was very old. I had almost the same question, but I didn't want to make a gif file, this vedeo is good Maybe it will help someone. It doesn't work for me. Because I want to know which frame is displayed at any moment. Share this post Link to post
vfbb 285 Posted November 13, 2023 Additional info: On RAD 12 it is possible to encode animated WebP (better format than GIF). See DocWiki. 1 Share this post Link to post
Lars Fosdal 1793 Posted November 13, 2023 Not to forget, FMX+SKIA+LOTTIE files. 1 Share this post Link to post
JohnLM 22 Posted December 8 @Anders Melander, thanks to your code above (Posted December 23, 2021) and a slight modification to allow me to use images screenshotted to the clipboard, I was able to create my first animated GIF file in Delphi XE7. Share this post Link to post
limelect 48 Posted December 15 If this might help you get in touch It is so old 2014 and I think it was done with D6 And I have to find the source. https://limelect.com/downloads/avi2gif-program-decode-avi-into-gif/ Share this post Link to post
limelect 48 Posted December 15 (edited) I found the source on D6 Edited December 15 by limelect Share this post Link to post
Anders Melander 1815 Posted December 15 I believe there's an AVI2GIF demo in the original TGIFimage 2.2 kit from... 1999! I should put all that old shit up on github and get it off my HD. Share this post Link to post
Anders Melander 1815 Posted December 15 40 minutes ago, limelect said: This is mine see link not nobady wut? Share this post Link to post
limelect 48 Posted December 16 @Anders Melander Have a look here https://limelect.com/downloads/avi2gif-program-decode-avi-into-gif/ Share this post Link to post