GIF, TIF, PNG and JPG pictures TGraphic read/write via GDI+
Implements TGraphic descendants able to load and save GIF, TIF, PNG and JPG pictures, using the GDI+ library. Freeware Opensource component, licensed under a MPL/GPL/LGPL tri-license. Works from Delphi 3 to 2010.
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;