Progressive Graphics File
PGF is a wavelet-based bitmapped image format that employs lossless and lossy data compression. PGF was created to improve upon and replace the JPEG format. It was developed at the same time as JPEG 2000 but with a focus on speed over compression ratio.
PGF can operate at higher compression ratios without taking more encoding/decoding time and without generating the characteristic "blocky and blurry" artifacts of the original DCT-based JPEG standard. It also allows more sophisticated progressive downloads.
Color models
PGF supports a wide variety of color models:- Grayscale with 1, 8, 16, or 31 bits per pixel
- Indexed color with palette size of 256
- RGB color image with 12, 16, 24, or 48 bits per pixel
- ARGB color image with 32 bits per pixel
- L*a*b color image with 24 or 48 bits per pixel
- CMYK color image with 32 or 64 bits per pixel
Technical discussion
The PGF process chain contains the following four steps:
- Color space transform
- Discrete Wavelet Transform
- Quantization
- Hierarchical bit-plane run-length encoding
Color components transformation
The chrominance components can be, but do not necessarily have to be, down-scaled in resolution.
Wavelet transform
The color components are then wavelet transformed to an arbitrary depth. In contrast to JPEG 1992 which uses an 8x8 block-size discrete cosine transform, PGF uses one reversible wavelet transform: a rounded version of the biorthogonal CDF 5/3 wavelet transform. This wavelet filter bank is exactly the same as the reversible wavelet used in JPEG 2000. It uses only integer coefficients, so the output does not require rounding and so it does not introduce any quantization noise.Quantization
After the wavelet transform, the coefficients are scalar-quantized to reduce the amount of bits to represent them, at the expense of a loss of quality. The output is a set of integer numbers which have to be encoded bit-by-bit. The parameter that can be changed to set the final quality is the quantization step: the greater the step, the greater is the compression and the loss of quality. With a quantization step that equals 1, no quantization is performed. In contrast to JPEG 2000, PGF uses only powers of two, therefore the parameter value i represents a quantization step of 2i. Just using powers of two makes no need of integer multiplication and division operations.Coding
The result of the previous process is a collection of sub-bands which represent several approximation scales.A sub-band is a set of coefficients — integer numbers which represent aspects of the image associated with a certain frequency range as well as a spatial area of the image.
The quantized sub-bands are split further into blocks, rectangular regions in the wavelet domain. They are typically selected in a way that the coefficients within them across the sub-bands form approximately spatial blocks in the image domain and collected in a fixed size macroblock.
The encoder has to encode the bits of all quantized coefficients of a macroblock, starting with the most significant bits and progressing to less significant bits. In this encoding process, each bit-plane of the macroblock gets encoded in two so-called coding passes, first encoding bits of significant coefficients, then refinement bits of significant coefficients. Clearly, in lossless mode all bit-planes have to be encoded, and no bit-planes can be dropped.
Only significant coefficients are compressed with an adaptive run-length/Rice coder, because they contain long runs of zeros. The RLR coder with parameter k is also known as the elementary Golomb code of order 2k.
Comparison with other file formats
- JPEG 2000 is slightly more space-efficient in handling natural images. The PSNR for the same compression ratio is on average 3% better than the PSNR of PGF. It has a small advantage in compression ratio but longer encoding and decoding times.
- PNG is more space-efficient in handling images with many pixels of the same color.
- Superior compression performance: The image quality for the same compression ratio is on average 3% better than the PSNR of JPEG. At lower bit rates, PGF has a much more significant advantage over certain modes of JPEG: artifacts are less visible and there is almost no blocking. The compression gains over JPEG are attributed to the use of DWT.
- Multiple resolution representation: PGF provides seamless compression of multiple image components, with each component carrying from 1 to 31 bits per component sample. With this feature there is no need for separately stored preview images.
- Progressive transmission by resolution accuracy, commonly referred to as progressive decoding: PGF provides efficient code-stream organizations which are progressive by resolution. This way, after a smaller part of the whole file has been received, it is possible to see a lower quality of the final picture, the quality can be improved monotonically getting more data from the source.
- Lossless and lossy compression: PGF provides both lossless and lossy compression in a single compression architecture. Both lossy and lossless compression are provided by the use of a reversible wavelet transform.
- Side channel spatial information: Transparency and alpha planes are fully supported
- ROI extraction: Since version 5, PGF supports extraction of regions of interest without decoding the whole image.
Available software
Digikam is a popular open-source image editing and cataloging software that uses libPGF for its thumbnails. It makes use of the progressive decoding feature of PGF images to store a single version of each thumbnail, which can then be decoded to different resolutions without loss, thus allowing users to dynamically change the size of the thumbnails without having to recalculate them again.
File extension
File extension.pgf and the TLA PGF are also used for unrelated purposes: - Adobe Illustrator used a Progressive Graphics Format before Encapsulated PostScript.
- PGF/TikZ uses a Portable Graphics Format in SourceForge project PGF.
- XnView and Konvertor associate file extension
.pgfwith Portfolio Graphics.