Page 1 of 1

XE3 and GIF files

Posted: Tue Jan 15, 2013 10:33 pm
by 9231397
in Delphi 6 I could save Tchat to GIF file with

procedure TForm1.Button1Click(Sender: TObject);
var tmpGIF : TGIFImage;
begin
tmpGIF:=TGIFImage.Create;
With tmpGIF do
begin
Compression:=gcLZW;
DitherMode:=dmStucki;
ColorReduction:=rmQuantizeWindows;
Assign(Chart1.TeeCreateBitmap(Chart1.Color,Rect(0,0,Chart1.Width,Chart1.Height)));
SaveToFile('c:\tempCharts\Chart1.gif');
end;
end;

But in XE3 I cannot use the old Anders Melanders gifunit, I understand gif is now part of
vcl.imaging.gifimg unit

Is there a recommended way to get Tchart imge out to a gif file with xe3?

I tried
var
tmpimage:timage;
.
tmpimage.Assign(Chart1.TeeCreateBitmap(Chart1.Color,Rect(0,0,Chart1.Width,Chart1.Height)));

and I tried
tmpimage.picture.Assign(Chart1.TeeCreateBitmap(Chart1.Color,Rect(0,0,Chart1.Width,Chart1.Height)));

both bomb at runtime with cannot assign a Tbitmap to a Timage. Any help appreciated.
thanks
Sean

Re: XE3 and GIF files

Posted: Wed Jan 16, 2013 7:59 am
by 9231397
got it working with
tmpimage.picture.Assign(Chart1.TeeCreateBitmap(Chart1.Color,Rect(0,0,Chart1.Width,Chart1.Height)));
tmpimage.picture.graphic.savetofile(path for gif file);

ref others porting to XE3 - don't put units tgifimage and teegif into your XE3 install or your project.
add unit vcl.imaging.gifimg to your uses

timage then has access to gif