一个压缩jpeg图片的过程
uses jpeg;
procedure ZipJPEG;
var
jpg: TJpegImage;
bmp: TBitmap;
begin
jpg := TJpegImage.Create;
bmp := TBitmap.Create;
try
jpg.LoadFromFile('c:\A.jpg');
bmp.Width := jpg.Width;
bmp.Height := jpg.Height;
bmp.Canvas.StretchDraw(bmp.Canvas.ClipRect, jpg);
jpg.Assign(bmp);
jpg.CompressionQuality := 10;
jpg.Compress;
jpg.SaveToFile('C:\AA.jpg');
finally
bmp.free;
jpg.free;
end;
end;