在delphi 2009中创建gif动画文件? [英] creating a gif animated file in delphi 2009?

查看:138
本文介绍了在delphi 2009中创建gif动画文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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吗?

This loops just once and the speed is not 500?

如何使其循环并设置速度?

How to make it loop and set the speed?

推荐答案

安德斯·梅兰德(Anders Melander)是最初的 TGIFImage ,具有以下 answer

Anders Melander, who wrote the original TGIFImage, has the following answer.


您需要在 Netscape Loop扩展块的第一帧添加您的GIF。
循环块必须是您为框架定义的第一个扩展,否则它将不起作用。

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.

请参见动画演示以示例演示如何制作动画GIF。

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

以下是动画演示的代码节选:

// 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文档在这里

这篇关于在delphi 2009中创建gif动画文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆