whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1548)

Database (90)
Files (137)
Forms (107)
Graphic (116)
IDE (21)
Indy (5)
Internet / LAN (131)
IntraWeb (0)
Math (76)
Misc (127)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (268)
VCL (243)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

14 Visitors Online


 
...convert a Bitmap to a JPEG and save it?
Autor: Andreas Rumsch
Homepage: http://www.ardesign.ch
[ Print tip ]  

Tip Rating (31):  
     


uses
  
Jpeg, ClipBrd;

procedure TfrmMain.ConvertBMP2JPEG;
  // konvertiert ein Bitmap, z.B. die Grafik eines TCharts in ein JPEG
  // converts a bitmap, the graphic of a TChart for example, to a jpeg
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;


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners