procedure BmpToJpeg(BmpPathName, JpegPathName: string);
var JpegPic: TJPEGImage;
BmpPic: TBitmap;
begin
JpegPic := TJPEGImage.Create;
BmpPic := TBitmap.Create;
try
BmpPic.LoadFromFile(BmpPathName);
JpegPic.Assign(BmpPic);
JpegPic.SaveToFile(JpegPathName);
except
on E: exception do
MessageBox(0, PChar(E.message), '错误', MB_OK);
end;
JpegPic.Free;
BmpPic.Free;
end;