如何获得动画gif的帧延迟? [英] How to get frame delay from animated gif?

查看:94
本文介绍了如何获得动画gif的帧延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试调整动画gif的大小.我将每个帧调整为位图大小,然后制作新的动画gif但我不知道如何获得与原始gif相同速度的动画的帧延迟.

I try resize animated gif. I resize each frame as bitmap and then make new animated gif but I don't know how to get frame delay for same speed animation as in original gif.

uses Gifimg;

procedure TForm1.FormCreate(Sender: TObject);
var
  gif: TGIFImage;
  bmp,bmp2: TBitmap;
  i:integer;
  gifren: TGIFRenderer;
  gif2:TGifImage;
begin
  gif:=TGIFImage.Create;
  gif2:=tgifimage.Create;
  bmp:=TBitmap.Create;
  bmp2:=TBitmap.Create;
    gif.LoadFromFile('d:\z.gif');
    gifren:=TGIFRenderer.Create(gif);
      for i:=0 to gif.Images.Count-1 do begin
      bmp.SetSize(gif.Width, gif.Height);
      gifren.Draw(bmp.Canvas, bmp.Canvas.ClipRect);
       bmp2.SetSize(1111,1111);
        bmp2.Canvas.StretchDraw(Rect(0, 0, 1111, 1111), bmp);

        TGIFGraphicControlExtension.Create(gif2.add(bmp2)).Delay:=10;
        gifren.NextFrame;
      end;
   TGIFAppExtNSLoop.Create(Gif2.Images.Frames[0]).Loops:=0;
   Gif2.SaveToFile('d:\gif.gif');
 end;

推荐答案

请参阅帮助

指定在移动到下一帧之前的延迟时间动画GIF.

Specifies the delay time before moving to the next frame in an animated GIF.

但是请考虑调整大小的图像可能需要更多的时间来渲染,并且可能无法跟上步伐.

But do consider that the resized image may require more time to render, and it may not be possible to keep up the pace.

这篇关于如何获得动画gif的帧延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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