반응형
procedure TMainForm.BMP2JPG(JPGFile: String; BMPFile: String);
var
Bmp: TBitmap;
Jpg : TjpegImage;
begin
Bmp := TBitmap.Create;
Jpg := TjpegImage.Create;
Bmp.LoadFromFile(BMPFile);
Jpg.Assign(Bmp);
Jpg.SaveToFile(JPGFile);
Bmp.Free;
Jpg.Free;
end;
procedure TMainForm.JPG2BMP(BMPFile: String; JPGFile: String);
var
Bmp: TBitmap;
Jpg : TjpegImage;
begin
Bmp := TBitmap.Create;
Jpg := TjpegImage.Create;
Jpg.LoadFromFile(JPGFile);
Bmp.Assign(Jpg);
Bmp.SaveToFile(BMPFile);
Bmp.Free;
Jpg.Free;
end;
var
Bmp: TBitmap;
Jpg : TjpegImage;
begin
Bmp := TBitmap.Create;
Jpg := TjpegImage.Create;
Bmp.LoadFromFile(BMPFile);
Jpg.Assign(Bmp);
Jpg.SaveToFile(JPGFile);
Bmp.Free;
Jpg.Free;
end;
procedure TMainForm.JPG2BMP(BMPFile: String; JPGFile: String);
var
Bmp: TBitmap;
Jpg : TjpegImage;
begin
Bmp := TBitmap.Create;
Jpg := TjpegImage.Create;
Jpg.LoadFromFile(JPGFile);
Bmp.Assign(Jpg);
Bmp.SaveToFile(BMPFile);
Bmp.Free;
Jpg.Free;
end;
반응형