Can someone help me make gifs


Registered since: Nov 30, 2005
Location: Munich
5,570 posts
 
Delphi 10.4 Sydney

Re: Animated GIF problem (while creating)

  Mar 13, 2008, 9:38 pm
Good evening,

so I had to adjust the method a bit since
I didn't know how your array BitMapArray is defined.
I have now solved that with an ImageList, but your way
should go too.

Delphi source code:
procedure TForm1.Button1Click (Sender: TObject);
var
FrameIndex: Integer;
Picture: TPicture;
begin
Screen.Cursor: = crHourGlass;
try
GifAnimateBegin;
{Step through each frame in in-memory list}
for FrameIndex: = 0 to BitMapArray.Count -1 do
begin
// add frame to animated gif
BitMapArray.GetBitmap (FrameIndex, Image1.Picture.Bitmap);
GifAnimateAddImage (Image1.Picture.Graphic, false, 1000);
end;
// We are using a TPicture but we could have used a TGIFImage instead.
// By not using TGIFImage directly we do not have to add GIFImage to the uses clause.
// By using TPicture we only need to add GifAnimate to the uses clause.
Picture: = GifAnimateEndPicture;
Picture.SaveToFile (ExtractFilePath (ParamStr (0)) + 'sphere.gif'); // save gif
//ImageMovieFrame.Picture.Assign(Picture); // display gif
Picture.Free;
finally
Screen.Cursor: = crDefault;
end;
end;
I cannot reproduce your mistake.

What I can still imagine is
that you did not write gifImage in the uses before FTGifAnimate.

Or imagine your declaration of BitMapArray.

greetings
Klaus