Table of Contents
YuPng
YuPNG – libpng for Delphi, no DLLs
YuPng brings libpng to Delphi, with its complete API of functions, types, and constants. libpng is the official PNG reference library. libpng supports almost all PNG features, is extensible, and extensively tested. YuPng links libpng statically, no DLLs needed.
The TYuPngImage
class desecends from TGraphic
. It loads and draws PNG images with support for embedded ICC color profile conversion, gamma correction, and chromaticities. Features:
- ICC (International Color Consortium) profile 2.0 and 4.4 color management based on Little CMS.
- All allowed PNG color types supported: RGB color, palette, and grayscale with 1, 2, 4, 8, and 16-bit bit depths, respectively.
- Alpha transparency.
- Progress callback with correct percentages, including interlaced PNG images.
Of course, all required code for TYuPngImage
is statically linked into executable binaries and needs no DLLs.
Next to TYuPngImage
, the complete libpng API is available for custom implementations to read and write, modify and create PNG images.
Demo projects, including a YuPng Image Viewer with thumbnails preview are included in the download.
What's different in YuPng and TYuPngImage?
YuPng came into being to make up for the deficiencies and bugs of Delphi's TPngImage
, for a demonstration of the most notorious ones see below.
All examples were created by Delphi 11.2 Alexandria, the most recent Delphi at the time of this writing. The left and right images are drawn on a checker board pattern to show their transparent pixels. The center image points out pixel differences with a red color overlay.
Minimum Code Example
{ Add the YuPngImage unit once to any uses clause to register TYuPngImage as the PNG handler. } uses Graphics, // For TPicture. YuPngImage; // Registers TYuPngImage. procedure LoadPng; var pic: TPicture; begin pic := TPicture.Create; try pic.LoadFromFile('image.png'); { Add code here to do something with the picture. } finally pic.Free; end; end;
3rd Party Problems Detected During YuPng Development
YuPng development uncovered a problem in Little CMS: