Imagem - jpg para bmp e bmp para jpg |
Top Previous Next |
uses JPEG;
procedure TForm1.Button1Click(Sender: TObject); var MyJPEG : TJPEGImage; MyBMP : TBitmap; begin { Convert a BMP to a JPEG }
MyBMP := TBitmap.Create; with MyBMP do try LoadFromFile('YourBmpHere.BMP'); MyJPEG := TJPEGImage.Create; with MyJPEG do begin Assign(MyBMP); SaveToFile('YourJpegHere.JPEG'); Free; end; finally Free; end; end;
procedure TForm1.Button2Click(Sender: TObject); var MyJPEG : TJPEGImage; MyBMP : TBitmap; begin { Convert a JPEG to a BMP }
MyJPEG := TJPEGImage.Create; with MyJPEG do begin LoadFromFile('YourJpegHere.JPEG'); MyBMP := TBitmap.Create; with MyBMP do begin Width := MyJPEG.Width; Height := MyJPEG.Height; Canvas.Draw(0,0,MyJPEG); SaveToFile('YourBmpHere.BMP'); Free; end; Free; end; end; |