gpt4 book ai didi

delphi - 在delphi 2009中创建gif动画文件?

转载 作者:行者123 更新时间:2023-12-03 15:08:48 24 4
gpt4 key购买 nike

gif := TgifImage.Create;
gif.Width := 100;
gif.Height := 100;
gif.AnimationSpeed := 500;
gif.Animate := true;
gif.add(image1.Picture.Bitmap);
gif.add(image2.Picture.Bitmap);
gif.add(image3.Picture.Bitmap);
gif.SaveToFile('gif.gif');

这个只循环一次,速度不是500?

如何让它循环播放并设置速度?

最佳答案

Anders Melander,原作者 TGIFImage ,具有以下answer .

You need to add a “Netscape Loop” extension block to the first frame of your GIF. The loop block must be the first extension you define for the frame or else it will not work.

See the Animate demo for an example of how to build an animated GIF.

以下是 Animate demo 的代码摘录:

// Add the source image to the animation
Result := GIF.Add(Source);

// Netscape Loop extension must be the first extension in the first frame!
if (GIF.Images.Count = 1) then
begin
LoopExt := TGIFAppExtNSLoop.Create(Result);
LoopExt.Loops := 0; // Number of loops (0 = forever)
end;

您可以查看TGIFImage documentation here .

关于delphi - 在delphi 2009中创建gif动画文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/930300/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com