this slowpoke moves

Convert Bitmap to Jpg


uses Jpeg;

procedure Bmp2Jpeg(const BmpFileName, JpgFileName: string);
var
  Bmp: TBitmap;
  Jpg: TJPEGImage;
begin
  Bmp := TBitmap.Create;
  Jpg := TJPEGImage.Create;
  try
    Bmp.LoadFromFile(BmpFileName);
    Jpg.Assign(Bmp);
    Jpg.SaveToFile(JpgFileName);
  finally
    Jpg.Free;
    Bmp.Free;
  end;
end;
Beispiel:

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then begin
   try
   Bmp2Jpeg(OpenDialog1.FileName, OpenDialog1.FileName + '.jpg');
   finally
   end;
  end;
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate