BMP2JPG,JPG2BMP

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;

 

posted @ 2010-12-28 10:50  Jekhn  阅读(357)  评论(0编辑  收藏  举报