var
InBmp:TBitmap;
OutJpeg:TJpegImage;
begin
InBmp:=TBitmap.Create;
try
InBmp.LoadFromFile(BMP文件名);
OutJpeg:=TJpegImage.Create ;
try
OutJpeg.Assign(InBmp);
OutJpeg.CompressionQuality :=80;//控制压缩质量
OutJpeg.Compress;
OutJpeg.SaveToFile(保存为JPEG文件名);
finally
OutJpeg.Free;
end;
finally
InBmp.Free;
end;
end;
一定要 uses jpeg