Lazarus-Animated gifs lazarus / 39-Graphics ---------------------------------------------------------------------- user5 · 2014-06-24 03:08 Is anyone familiar with a Lazarus public license project program called test.gif that uses the units fmain, MemBitmap and AnimatedGif? It works well but I’m trying to figure out how to stop it from automatically looping animated gifs. Thanx. ---------------------------------------------------------------------- user5 · 2014-06-24 04:11 I downloaded BGRAAnimatedGif. Can anyone give me an example of how to use it to display an animated gif made from a bunch of single frames? I’ve looked everywhere. ---------------------------------------------------------------------- exdatis · 2014-06-24 05:20 See: http://www.youtube.com/watch?v=EVk28wzHNII http://lazarus.johann-elsass.net/ ---------------------------------------------------------------------- circular · 2014-06-24 15:53 user5, the image source you have is in Gif format? If it is, just use LoadFromFile. Otherwise, well the class TBGRAAnimatedGif is read-only so you can't add frames from let's say a bunch of PNG files. You could derive this class however and modify FImages variable. ---------------------------------------------------------------------- user5 · 2014-06-24 23:29 Thank you exdatis and circular. I had some problem with Utube so I couldn’t check that out but basically I’m trying to learn how to display an animated gif in my form. Oddly enough, I figured out how to display an .avi or .mpg. The program described in my first post plays gifs in a PaintBox and I can easily use it in my program but it’s quite large, though it can play any number of gifs. To get to the point where I do something like animate := TBGRAAnimatedGif.create I suppose that I need to install the package BGRABitmap6.3 and I tried to do that but I got an error message about improper registration. Unless I’m mistaken, BGRABitmap is a Delphi package and I’ve heard that it requires some adaptation for use in Lazarus. To answer your question, I don’t yet know if I’ll end up using an animated gif or its extracted frames. I may use the same technique to play animated gifs that I use for playing .mpgs, by extracting frames and then displaying them. I might not be at your level of expertise so you might have to talk down to me a bit. Thanks so much. ---------------------------------------------------------------------- user5 · 2014-06-25 00:48 Wow! I just discovered something big, for me anyway. It would be nice to to change an animated gif into a transparency at runtime if it wasn’t already transparent and I just found out by testing that a transparent TImage will make a bitmap transparent, but not a single frame .gif! This means that I’ll have to split an animated gif into frames and then convert them into .bmps or do both at the same time, which I can do. I can do this in a hidden way thanks to Tprocess and other stuff. I’m still considering the various possibilities here. Thanx again to you and to LAZARUS, which makes everything possible for me. I can’t describe the great, good impact that Lazarus has had on my life. ---------------------------------------------------------------------- circular · 2014-06-25 11:17 Yes TBGRAAnimatedGif requires BGRABitmap. It is a Lazarus package, not a Delphi package. So it is possible to install it in a few steps: http://wiki.freepascal.org/BGRABitmap_tutorial_1 However if that takes to much space, there is the standalone version of it: http://lazarus.johann-elsass.net/animatedgif.zip You don't need to split the Gif if you use TAnimatedGif. There are properties CurrentImage and Bitmap. It also has some basic handling of time. If you want to handle it yourself, then you can add a function like the following in TAnimatedGif, that will return the delay in milliseconds. Code: [Select]function TAnimatedGif.GetImageDelay: integer; begin   if (FWantedImage >= 0) and (FWantedImage < Length(FImages)) then     result := FImages[FWantedImage].Delay   else     result := 0; end; So you can increase the current image, display it and wait before displaying the next one. ---------------------------------------------------------------------- user5 · 2014-06-26 04:07 I tried to install the bgrabitmap package a while back but it wasn’t successful, though I can try again. I have installed packages before but maybe I did something wrong on that one. Sometimes I just can’t figure out how to use these things properly and it can be fustrating and bewildering. Will check out the tutorial you suggested when I get a chance. I downloaded the standalone version and will look at it shortly. One big concern: Whatever I end up deciding to do, I very much want the user to be able to make imported animated gifs transparent. Yes, size is important. My program is now over 50 M and I've never made one that big. I have quite a few options here and I want to choose the right one, but I’m grateful for having 'em. Thanks again. ---------------------------------------------------------------------- user5 · 2014-06-26 04:52 !!!! Right after I posted that last message, I remembered that I read somewhere that RGBABitmap requires a later version of Lazarus than what I use, which is 1.0.10-fpc-2.6.2. I’m certain that I read that somewhere but I haven’t been able to find it again. That might be the problem! I also have the zip file of Lazarus 1.2.0-fpc-2.6.2 but I don’t want to have to recreate the properties list. I have so much to do now that it’s really kind of daunting and my program will grow even more larger. By the way, thanks for correcting me about the fact that RGBABitmap is a Lazarus package and not a Delphi package. I was thinking of some other similar Delphi package.