Lossless JPEG is a mode of the original JPEG (Joint Photographic Experts Group) image compression standard defined in ISO/IEC 10918‑1 (also known as ITU‑T 81). Unlike the more common baseline JPEG mode, which employs discrete cosine transform (DCT) based lossy compression, the lossless mode uses predictive coding to achieve compression without any loss of image data.
Technical Characteristics
| Feature | Description |
|---|---|
| Coding Method | Predictive coding based on neighboring pixel values. The prediction can be a simple value (e.g., left pixel) or a more complex linear function of surrounding pixels. |
| Entropy Coding | After prediction, the residual (difference between actual and predicted pixel values) is encoded using Huffman coding. |
| Supported Color Spaces | Primarily grayscale and YCbCr. The lossless mode can also be applied to RGB data, though support is less common in consumer implementations. |
| Bit Depth | Handles a range of sample precisions, typically 8‑bit, but can support up to 12‑bit or higher per component as defined in the standard. |
| File Extension | Often stored in files with the conventional “.jpg” or “.jpeg” extension, though some implementations use “.ljp” or “.jls”. |
| Compatibility | Most mainstream image viewers and web browsers do not support the lossless mode, limiting its practical deployment. Specialized software and libraries (e.g., libjpeg, ImageMagick with specific flags) can read and write lossless JPEG files. |
Historical Context
- The JPEG standard was published in 1992 and included both a baseline (lossy) mode and a lossless mode to provide flexibility for applications where data integrity is critical (e.g., medical imaging, archival).
- Early implementations of lossless JPEG saw limited adoption because the compression efficiency was inferior to the later JPEG‑LS (ISO/IEC 14495) and JPEG 2000 lossless modes, both of which offered better bitrate‑quality trade‑offs and more robust feature sets.
Relationship to Other Standards
- JPEG‑LS (Lossless JPEG Standard): A separate standard (ISO/IEC 14495) introduced in 1999 that improves on the original lossless JPEG by using a more efficient context‑based predictive model and Golomb‑Rice coding. JPEG‑LS is often referred to simply as “Lossless JPEG” in informal contexts, but technically it is a distinct specification.
- JPEG 2000: Provides both lossy and lossless compression within a single codestream, using wavelet transforms. It is more widely supported for lossless use cases than the original lossless JPEG mode.
Use Cases
- Medical Imaging: Where pixel‑perfect fidelity is required and DICOM files may embed lossless JPEG for specific image types.
- Archival Preservation: Situations demanding exact reproduction of original raster data without the storage overhead of raw formats.
- Document Scanning: Certain high‑resolution scanners and OCR pipelines historically offered lossless JPEG as an option to balance file size and fidelity.
Limitations
- Compression Efficiency: Typically yields larger files compared to JPEG‑LS and JPEG 2000 lossless modes for the same image content.
- Software Support: Limited native support in web browsers and many consumer image applications, reducing its suitability for general distribution.
- Complexity of Implementation: The predictive coding and Huffman tables are less straightforward than the DCT‑based baseline JPEG, leading to fewer open‑source implementations.
Current Status
While the lossless mode of JPEG remains part of the official JPEG standard and is still implemented in some niche tools, industry practice has largely shifted toward JPEG‑LS, JPEG 2000, or lossless PNG for applications requiring lossless image compression. Nonetheless, the term “Lossless JPEG” continues to be used in technical literature to denote the predictive coding mode defined in ISO/IEC 10918‑1.