By adding the SynGdiPlus unit to your uses clause, these TGraphic descendants are registered in your application to load GIF, TIF, PNG and JPG pictures. Use TPicture.LoadFromFile() method with the right extension, and the corresponding decoder will be used.
This unit implements its own GDI+ API functions, in a safe dynamic manner. Even if you don't have GDI+ installed on the system (e.g. with Windows 2000), the executable will launch - but all GIF, TIF, PNG and JPG pictures loading and saving won't work. Please note that the GDI+ library is available on all Windows Operating System since Windows XP (including Vista and Seven).
Since all the decoding and encoding is done by the GDI+ library, this unit adds much less code to your executable than the standard JPEG and PNG units.
These classes handle the saving of the pictures. Most GDI+ implementation just allows you to load pictures. This unit handle all the saving and conversion between formats. You can easily load an TIF, then save it as a JPG file with a specified Compression Quality, via the SaveAs() method.
Some easy one line helper functions are available:
function LoadFrom(const FileName: TFileName): TBitmap;
procedure SaveAs(Graphic: TPersistent; Stream: TStream; Format: TGDIPPictureType; CompressionQuality: integer=80); overload;
procedure SaveAs(Graphic: TPersistent; const FileName: TFileName; Format: TGDIPPictureType; CompressionQuality: integer=80); overload;
1 From A.Bouchez - 23/09/2010, 16:10
Antialiased drawing from TMetaFile has been added to this unit.
Therefore, you can draw using a regular TCanvas, then use GDI+ to render it with proper anti-aliasing.
See this post for further details.