본문 바로가기
Application/Delphi Lecture

bmp, jpeg 상호 변환

by 현이빈이 2008. 8. 13.
반응형
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;
반응형