XE3 and GIF files

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
seanmurphy
Newbie
Newbie
Posts: 48
Joined: Fri Mar 12, 2004 5:00 am

XE3 and GIF files

Post by seanmurphy » Tue Jan 15, 2013 10:33 pm

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

seanmurphy
Newbie
Newbie
Posts: 48
Joined: Fri Mar 12, 2004 5:00 am

Re: XE3 and GIF files

Post by seanmurphy » Wed Jan 16, 2013 7:59 am

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

Post Reply