Table of Contents

YuImage

YuImage is a collection of image processing libraries and classes, such as Delphi ports of Little CMS, libpng, and libwebp, all statically linked, no DLLs needed.

Overview

YuImage is a collection of image processing libraries, classes and functions for Delphi. In particular, it contains Delphi ports of the following C libraries, all with complete API, statically linked, and no DLLs needed:

Little CMS / YuLcms2.pas: A small-footprint color management engine

Little CMS implements fast transformations between color profiels based on the International Color Consortium (ICC) 4.4 specification and support for all kinds of V2 and V4 profiles.

libpng / YuPng.pas: The official PNG reference library

libpng supports almost all features of the PNG image format, is extensible, and extensively tested.

TYuPngImage is an image class which descends from TGraphic. It loads and draws PNG encoded images with transparency and automatically applies embedded ICC color profiles, gamma correction, and chromaticities.

libwebp / YuWebP.pas: The official WebP refernce library

WebP is a modern image format that provides superior lossless and lossy image compression. It can create smaller and richer images. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent perceived quality.

TYuWebPImage is a TGraphic descendent image class. It loads and draws WebP encoded images with alpha transparency and automatically applies embedded ICC profiles. TYuWebPImage renders animated WebP images.

Demo projects, including an Image Viewer with thumbnails preview, are included in the download.

Minimum TYuPngImage and TYuWebPImage Code Example

{ Add the YuPngImage and YuWebPImage units once to any uses clause to register 
  TYuPngImage as the PNG handler and TYuWebPImage as the WebP handler. }
uses
  Graphics,    // For TPicture.
  YuPngImage,  // Register TYuPngImage.
  YuWebPImage; // Register TYuWebPImage.
 
procedure LoadImages;
var
  pic: TPicture;
begin
  pic := TPicture.Create;
  try
    pic.LoadFromFile('test.png'); // Load a PNG image.
    { Add code here to do something with the picture. }
  finally
    pic.Free;
  end;
 
  pic := TPicture.Create;
  try
    pic.LoadFromFile('test.webp'); // Load a WebP image.
    { Add code here to do something with the picture. }
  finally
    pic.Free;
  end;
end;

Why TYuPngImage, yet another Delphi PNG image class?

Because TPngImage, Delphi's own PNG image class, if faulty. TYuPngImage fixes some annoying bugs and deficiencies of TPngImage, as demonstrated below.

The examples were painted 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.

3rd Party Problems Detected During YuImage Development

YuImage development uncovered a problem in Little CMS: