What is a PGF File?

Progressive Graphics File is a wavelet-based raster format that supports progressive decoding. It can encode image data with either lossy or lossless compression.

How PGF Files work

PGF transforms raster samples into wavelet coefficients arranged as a pyramid of resolution levels. A decoder can stop after a lower-resolution level or keep reading to reach full size, which makes progression structural rather than a separate preview image. The reference implementation is the open-source libPGF codec, and one documented production use is digiKam, which stores the thumbnails in its internal database as PGF. Metadata travels in an optional user-data block whose layout the libPGF documentation only proposes, so do not assume that another tool will find EXIF or XMP there. Establish both encoder availability and the recipient’s ability to parse PGF before using it for interchange.

Key facts

  1. A preview usually does not require the whole file. The header stores the number of pyramid levels, and each level has about a quarter of the pixels of the next larger one (libPGF rounds odd widths and heights up when halving). A directory of level sizes after the header gives the number of bytes needed to decode the smallest level and each further one, so a reader can fetch a prefix of the file, decode a small image, and continue later. libPGF exposes this as a level argument to its read call, where level 0 is the full-size image. Check the level count first: libPGF gives small images fewer levels and very small ones none, so such a file may hold only its full-size image.
  2. Whether a PGF file is lossless is recorded in its header, not in its name. The quality field is 0 for lossless compression; larger values quantize the wavelet coefficients more coarsely, and the libPGF documentation describes quality 4 as lossy but still very good. Lossless describes only the PGF encoding step: a quality-0 file decodes to the pixels its encoder received, which may already have been resized or edited, as a thumbnail has been. Different dimensions rule out an exact copy, but matching dimensions do not prove one: compare the decoded full-size pixels with the original before treating a file as an exact copy.
  3. Identify PGF by content: a file starts with the ASCII bytes PGF, followed by a version byte, and its multi-byte fields are little-endian. The .pgf suffix alone is ambiguous. Matplotlib’s pgf backend, for example, saves .pgf files that contain LaTeX drawing commands, not PGF image data.
  4. Browsers do not display PGF: it is not among the image formats that MDN’s image format guide lists for the web, so web delivery needs conversion to a format such as JPEG, PNG, or WebP. Expect limited support outside libPGF: digiKam’s documentation calls PGF “not so well known”, and in 2018 a user in digiKam’s bug tracker who wanted to reuse the application’s PGF thumbnails elsewhere reported finding few other libraries. In 2020 the maintainer answered with a standalone PGF-to-PNG converter.

When PGF Files matter

Add PGF support when an archive or existing application depends on the format. Its limited adoption compared with JPEG or PNG may constrain available decoders, encoders, and browser compatibility.

Sources

Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

Try Transloadit for free