[SOLVED] Is there a Way to Save Animated GIFs? lazarus / 39-Graphics ---------------------------------------------------------------------- pixelink · 2019-10-13 14:20 Is there a Way to Save Animated GIFs? Maybe a library or package ---------------------------------------------------------------------- lainz · 2019-10-13 14:25 BGRABitmap can save Gif, you maybe can look how it's done inside LazPaint for example. ---------------------------------------------------------------------- pixelink · 2019-10-13 14:41 Quote from: lainz on October 13, 2019, 04:25:08 pmBGRABitmap can save Gif, you maybe can look how it's done inside LazPaint for example. I am aware that it can save a GIF. But what about an Animated GIF... you know, multiple images into one animated gif. ---------------------------------------------------------------------- lainz · 2019-10-13 14:49 Quote from: pixelink on October 13, 2019, 04:41:01 pmQuote from: lainz on October 13, 2019, 04:25:08 pmBGRABitmap can save Gif, you maybe can look how it's done inside LazPaint for example. I am aware that it can save a GIF. But what about an Animated GIF... you know, multiple images into one animated gif. It can save a gif with multiple frames, try opening an animated gif, select a frame and edit it, then save. The frame is saved inside the animated gif. So it can. ---------------------------------------------------------------------- pixelink · 2019-10-13 15:23 Quote from: lainz on October 13, 2019, 04:49:18 pmQuote from: pixelink on October 13, 2019, 04:41:01 pmQuote from: lainz on October 13, 2019, 04:25:08 pmBGRABitmap can save Gif, you maybe can look how it's done inside LazPaint for example. I am aware that it can save a GIF. But what about an Animated GIF... you know, multiple images into one animated gif. It can save a gif with multiple frames, try opening an animated gif, select a frame and edit it, then save. The frame is saved inside the animated gif. So it can. Okay.. will check it out. thanks ---------------------------------------------------------------------- pixelink · 2019-10-13 15:44 Quote from: lainz on October 13, 2019, 04:49:18 pmQuote from: pixelink on October 13, 2019, 04:41:01 pmQuote from: lainz on October 13, 2019, 04:25:08 pmBGRABitmap can save Gif, you maybe can look how it's done inside LazPaint for example. I am aware that it can save a GIF. But what about an Animated GIF... you know, multiple images into one animated gif. It can save a gif with multiple frames, try opening an animated gif, select a frame and edit it, then save. The frame is saved inside the animated gif. So it can. Okay, tried it. 1) When I open a gif, it shows me all frames in a popup window, but I can only choose one And it loads just one fram into one layer. 2) If I load two frames, one-by-one, I can have multiple layers But, when I save it as an animated gif there is no animating What am i missing? ---------------------------------------------------------------------- lainz · 2019-10-13 21:36 Quote from: pixelink on October 13, 2019, 05:44:33 pmWhat am i missing? Reading the source code? I created this snippet only with the information given at lazpaint procedure TLazPaintImage.UpdateGifFileUTF8(AFilename: string;   AOutputFilename: string);  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  gif : TBGRAAnimatedGif;  bmp: TBGRABitmap;begin  bmp := TBGRABitmap.Create(100,100,BGRAWhite);  bmp.FontHeight := 30;  bmp.TextRect(Rect(0,0,100,100), 'Hello', taCenter, tlCenter, BGRABlack);   gif := TBGRAAnimatedGif.Create;  gif.SetSize(100,100);  gif.LoopCount:=100;  gif.AddFullFrame(bmp, 500);   bmp.Fill(BGRAWhite);  bmp.TextRect(Rect(0,0,100,100), 'World', taCenter, tlCenter, BGRABlack);   gif.AddFullFrame(bmp, 500);  gif.SaveToFile('image.gif');  gif.Free;   bmp.Free; ---------------------------------------------------------------------- pixelink · 2019-10-14 00:30 Quote from: lainz on October 13, 2019, 11:36:01 pmQuote from: pixelink on October 13, 2019, 05:44:33 pmWhat am i missing? Reading the source code? I created this snippet only with the information given at lazpaint procedure TLazPaintImage.UpdateGifFileUTF8(AFilename: string;   AOutputFilename: string);  Thanks Lainz I didn't read the code because LAZPaint wasn't creating an Animated gif (with layers) from the way I was using it. That's why i ask "What am I Missing". Why wasn't LAZPaint working by opening, adding two images (as Layers) and save as Animated Gif? I didn't see any other way to make LAZ Paint work out of the box. Thanks for the code, that seems pretty easy. Just one q: How do I set the frame length for each frame in miliseconds or seconds? ---------------------------------------------------------------------- lainz · 2019-10-14 00:50 Yes is planned to do the saving from the layers to animations. But it can open a gif and save the frame into the same animated gif. That's from where I get the code. The second parameter of addfullframe sets the frame duration. ---------------------------------------------------------------------- pixelink · 2019-10-14 00:57 Quote from: lainz on October 14, 2019, 02:50:28 amYes is planned to do the saving from the layers to animations. But it can open a gif and save the frame into the same animated gif. That's from where I get the code. The second parameter of addfullframe sets the frame duration. Okay... What does this do. I stumbled across this gif.AverageDelayMs ---------------------------------------------------------------------- circular · 2019-10-14 21:32 It returns the average of the frame durations in the file. It gives you an idea of the speed ---------------------------------------------------------------------- winni · 2019-10-15 16:25 Hi! Creating an amimated GIF with BGRA - that's cool. In the Gimp this a lot of tricky handicraft. And in BGRA it's such easy! Thank you circular! Winni ---------------------------------------------------------------------- circular · 2019-10-16 13:31 You’re welcome  Next step maybe is to provide optimisations of GIF. Some files where only a small part of the image change could be smaller.