BMP в JPG

Материал из DRKB


uses
  Jpeg, ClipBrd;

// converts a bitmap, the graphic of a TChart for example, to a jpeg
procedure TfrmMain.ConvertBMP2JPEG;
var
  jpgImg: TJPEGImage;
begin
  // copy bitmap to clipboard
  chrtOutputSingle.CopyToClipboardBitmap;
  // get clipboard and load it to Image1
  Image1.Picture.Bitmap.LoadFromClipboardFormat(cf_BitMap,
    ClipBoard.GetAsHandle(cf_Bitmap), 0);
  // create the jpeg-graphic
  jpgImg := TJPEGImage.Create;
  // assign the bitmap to the jpeg, this converts the bitmap
  jpgImg.Assign(Image1.Picture.Bitmap);
  // and save it to file
  jpgImg.SaveToFile('TChartExample.jpg');
end;


Source: http://www.swissdelphicenter.ch/en/tipsindex.php
ID: 04269


См. также[править | править код]