procedure TForm14.Button2Click(Sender: TObject);
var
i:TBitmap;
j:TjpegImage;
begin
form14.SavePictureDialog1.DefaultExt:='jpg';//'.jpg';
//set the default file ext
i:=TBitmap.Create;
j:=TjpegImage.Create;
i.LoadFromFile(form14.OpenPictureDialog1.FileName);
j.Assign(i);
if form14.SavePictureDialog1.Execute then
j.SaveToFile(form14.SavePictureDialog1.FileName);
i.Free;
j.Free;
{ }
end;
//此段为JPG转换为BMP,但转换后保存的文件仍是JPG文件哦?????????????????
procedure TForm14.Button3Click(Sender: TObject);
var
i:TBitmap;
j:TjpegImage;
begin
form14.SavePictureDialog1.DefaultExt:='bmp';
i:=TBitmap.Create;
j:=TjpegImage.Create;
j.LoadFromFile(form14.OpenPictureDialog1.FileName);
i.Assign(j);
if form14.SavePictureDialog1.Execute then
j.SaveToFile(form14.SavePictureDialog1.filename);
i.Free;
j.Free;
end;
来源:https://www.cnblogs.com/huking/archive/2010/04/01/1701863.html