BMP2JPG,JPG2BMP


//
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 ;