bmp to jpg
var
Bmp:TBitmap;
Jpg:TJpegImage;
begin
Bmp:=TBitmap.Create;
Jpg:=TJpegImage.Create;
try
Bmp.LoadFromFile(IuputFileName);
Jpg.Assign(Bmp);
Jpg.CompressionQuality:=30;
Jpg.SaveToFile(OutputFileName);
finally
Bmp.Free;
Jpg.Free;
end;
end;
jpg to bmp
uses Jpeg;
var
jpg :TJpegImage;
bmp :TBitmap;
begin
jpg :=TJpegImage.Create;
jpg.LoadFromFile('图片路径');
bmp :=TBitmap.Create;
bmp.Assign(jpg);
bmp.SaveToFile('存储的路径');
bmp.Free;
jpg.Free;
end;