BMP2JPG,JPG2BMP
![](http://img.e-com-net.com/image/info8/b8d97b5613f94ed2ba791cad57d0b2ed.gif)
![](http://img.e-com-net.com/image/info8/2f88dd3f1cd145f59c0e47b51acdbd4b.gif)
//
uses
jpeg
procedure BMP2JPG( const BMPFile: string );
var
BMP: TBitmap;
JPG: TJpegImage;
FileName: string ;
begin
FileName : = BMPFile;
BMP : = TBitmap.Create;
JPG : = TJpegImage.Create;
try
BMP.LoadFromFile(FileName);
JPG.Assign(BMP);
FileName : = ChangeFileExt(FileName, ' .jpg ' );
JPG.SaveToFile(FileName);
finally
BMP.Free;
JPG.Free;
end ;
end ;
procedure JPG2BMP( const JPGFile: string );
var
BMP: TBitmap;
JPG: TJpegImage;
FileName: string ;
begin
FileName : = JPGFile;
BMP : = TBitmap.Create;
JPG : = TJpegImage.Create;
try
JPG.LoadFromFile(FileName);
BMP.Assign(JPG);
FileName : = ChangeFileExt(FileName, ' .bmp ' );
BMP.SaveToFile(FileName);
finally
BMP.Free;
JPG.Free;
end ;
end ;
procedure BMP2JPG( const BMPFile: string );
var
BMP: TBitmap;
JPG: TJpegImage;
FileName: string ;
begin
FileName : = BMPFile;
BMP : = TBitmap.Create;
JPG : = TJpegImage.Create;
try
BMP.LoadFromFile(FileName);
JPG.Assign(BMP);
FileName : = ChangeFileExt(FileName, ' .jpg ' );
JPG.SaveToFile(FileName);
finally
BMP.Free;
JPG.Free;
end ;
end ;
procedure JPG2BMP( const JPGFile: string );
var
BMP: TBitmap;
JPG: TJpegImage;
FileName: string ;
begin
FileName : = JPGFile;
BMP : = TBitmap.Create;
JPG : = TJpegImage.Create;
try
JPG.LoadFromFile(FileName);
BMP.Assign(JPG);
FileName : = ChangeFileExt(FileName, ' .bmp ' );
BMP.SaveToFile(FileName);
finally
BMP.Free;
JPG.Free;
end ;
end ;