HPDFDecodeWebPLossless Function

function HPDFDecodeWebPLossless(const Data: TBytes; out Width,
  Height: Integer; out Pixels: TWebPCardinalArray): boolean;

function HPDFDecodeWebPLosslessEx(const Data: TBytes; out Width,
  Height: Integer; out Pixels: TWebPCardinalArray;
  out Reason: TWebPRejectReason): boolean;

function HPDFWebPRejectReasonText(const Reason: TWebPRejectReason): string;

function HPDFDecodeWebPToBitmapEx(const Data: TBytes;
  out Reason: TWebPRejectReason): TBitmap;

function HPDFDecodeWebPFileToBitmapEx(const FileName: string;
  out Reason: TWebPRejectReason): TBitmap;

Decodes the first VP8L (lossless) frame of a WebP byte stream per RFC 9649, returning Width * Height ARGB values ($AARRGGBB, one Cardinal per pixel in scan-line order)

The decoder implements canonical prefix codes with simple and normal code length codes, spatial meta prefix codes through the entropy image, LZ77 backward references with the 120-entry neighbourhood distance map, the multiplicative colour cache ($1e35a7bd hash), and all four inverse transforms: the 14-mode block predictor with border rules, the 3.5-fixed-point colour transform, subtract-green and colour indexing with 8/4/2/1-bit pixel bundling

Lossy VP8 frames and animations are rejected as an explicit unsupported boundary, as are malformed RIFF containers; HPDFDecodeWebPToBitmap and HPDFDecodeWebPFileToBitmap are bitmap convenience wrappers with the same boundary

TWebPRejectReason names why an attempt produced no image: wrrNone pairs only with a successful decode, and a rejection is one of wrrNotWebP, wrrMalformedContainer, wrrLossy, wrrAnimated, wrrNoLosslessChunk, wrrBitstream, wrrBitmapBuildFailed or wrrUnreadableFile, the last of which comes only from the file wrapper

The Ex forms make the same accept or reject decision and return the same pixels as the forms without the Reason argument, so the plain functions are the wrappers here rather than a second decoder; HPDFWebPRejectReasonText renders a reason as a short phrase, which is what THotPDF.AddImageFromFile embeds in the message it raises for a rejected .webp source

THotPDF.AddImageFromFile accepts .webp files through this decoder for any embedding compression

THotPDF.AddImageFromFile