JPG转换成BMP不成功???

浪尽此生 提交于 2020-02-19 08:22:31

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;

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!