JPEG File Interchange Format

Last updated

The JPEG File Interchange Format (JFIF) is an image file format standard published as ITU-T Recommendation T.871 and ISO/IEC 10918-5. It defines supplementary specifications for the container format that contains the image data encoded with the JPEG algorithm. The base specifications for a JPEG container format are defined in Annex B of the JPEG standard, known as JPEG Interchange Format (JIF). JFIF builds over JIF to solve some of JIF's limitations, including unnecessary complexity, component sample registration, resolution, aspect ratio, and color space. Because JFIF is not the original JPG standard, one might expect another MIME type. However, it is still registered as "image/jpeg" (indicating its primary data format rather than the amended information).

Contents

JFIF is mutually incompatible with the newer Exchangeable image file format (Exif).

Purpose

JFIF defines a number of details that are left unspecified by the JPEG Part 1 standard (ISO/IEC 10918-1, ITU-T Recommendation T.81.) [1]

Component sample registration

JPEG allows multiple components (such as Y, Cb, and Cr) to have different resolutions, but it does not define how those differing sample arrays (which render bitmaps) should be aligned. This pixel-producing information is rendered with the expectation of indicating rectangles by their centeroid, rather than being pixel data directly, or being 'first corner and flood', etc. which is uncommon.

Resolution and aspect ratio

The JPEG standard does not include any method of coding the resolution or aspect ratio of an image. JFIF provides resolution or aspect ratio information using an application segment extension to JPEG. It uses Application Segment #0, with a segment header consisting of the null-terminated string spelling "JFIF" in ASCII followed by a byte equal to 0, and specifies that this must be the first segment in the file, hence making it simple to recognize a JFIF file. Exif images recorded by digital cameras generally do not include this segment, but typically comply in all other respects with the JFIF standard.

Color space

The JPEG standard used for the compression coding in JFIF files does not define which color encoding is to be used for images. JFIF defines the color model to be used: either Y for greyscale, or YCbCr derived from RGB color primaries as defined in CCIR 601 (now known as Rec. ITU-R BT.601), except with a different "full range" scaling of the Y, Cb and Cr components. Unlike the "studio range" defined in CCIR 601, in which black is represented by Y=16 and white by Y=235 and values outside of this range are available for signal processing "headroom" and "footroom", JFIF uses all 256 levels of the 8-bit representation, so that Y=0 for black and Y=255 for peak white. The RGB color primaries defined in JFIF via CCIR 601 also differ somewhat from what has become common practice in newer applications (e.g., they differ slightly from the color primaries defined in sRGB). Moreover, CCIR 601 (before 2007) did not provide a precise definition of the RGB color primaries; it relied instead on the underlying practices of the television industry.

Color interpretation of a JFIF image may be improved by embedding an ICC profile, colorspace metadata, or an sRGB tag, and using an application that interprets this information.

File format structure

A JFIF file consists of a sequence of markers or marker segments (for details refer to JPEG, Syntax and structure). The markers are defined in part 1 of the JPEG Standard. [1] Each marker consists of two bytes: an FF byte followed by a byte which is not equal to 00 or FF and specifies the type of the marker. Some markers stand alone, but most indicate the start of a marker segment that contains data bytes according to the following pattern:

FF xxs1s2[data bytes]

The bytes s1 and s2 are taken together to represent a big-endian 16-bit integer specifying the length of the following "data bytes" plus the 2 bytes used to represent the length. In other words, s1 and s2 specify the number of the following data bytes as .

According to part 1 of the JPEG standard, applications can use APP marker segments and define an application specific meaning of the data. In the JFIF standard, the following APP marker segments are defined:

They are described below.

The JFIF standard requires that the JFIF APP0 marker segment immediately follows the SOI marker. If a JFIF extension APP0 marker segment is used, it must immediately follow the JFIF APP0 marker segment. [2] So a JFIF file will have the following structure:

JFIF file structure
SegmentCodeDescription
SOIFF D8Start of Image
JFIF-APP0FF E0 s1s2 4A 46 49 46 00 ...see below
JFXX-APP0FF E0 s1s2 4A 46 58 58 00 ...optional, see below
… additional marker segments
(for example SOF, DHT, COM)
SOSFF DAStart of Scan
compressed image data
EOIFF D9End of Image

JFIF APP0 marker segment

In the mandatory JFIF APP0 marker segment the parameters of the image are specified. Optionally an uncompressed thumbnail can be embedded.

JFIF APP0 marker segment
FieldSize (bytes)Description
APP0 marker2FF E0
Length2Length of segment excluding APP0 marker
Identifier54A 46 49 46 00 = "JFIF" in ASCII, terminated by a null byte
JFIF version2First byte for major version, second byte for minor version (01 02 for 1.02)
Density units1Units for the following pixel density fields
  • 00 : No units; width:height pixel aspect ratio = Ydensity:Xdensity
  • 01 : Pixels per inch (2.54 cm)
  • 02 : Pixels per centimeter
Xdensity2Horizontal pixel density. Must not be zero
Ydensity2Vertical pixel density. Must not be zero
Xthumbnail1Horizontal pixel count of the following embedded RGB thumbnail. May be zero
Ythumbnail1Vertical pixel count of the following embedded RGB thumbnail. May be zero
Thumbnail data3 × nUncompressed 24 bit RGB (8 bits per color channel) raster thumbnail data in the order R0, G0, B0, ... Rn-1, Gn-1, Bn-1; with n = Xthumbnail × Ythumbnail

JFIF extension APP0 marker segment

Immediately following the JFIF APP0 marker segment may be a JFIF extension APP0 marker segment. This segment may only be present for JFIF versions 1.02 and above. It allows to embed a thumbnail image in 3 different formats.

JFIF extension APP0 marker segment
FieldSize (bytes)Description
APP0 marker2FF E0
Length2Length of segment excluding APP0 marker
Identifier54A 46 58 58 00 = "JFXX" in ASCII, terminated by a null byte
Thumbnail format1Specifies what data format is used for the following embedded thumbnail:
  • 10 : JPEG format
  • 11 : 1 byte per pixel palettized format
  • 13 : 3 byte per pixel RGB format
Thumbnail datavariableDepends on the thumbnail format, see below

The thumbnail data depends on the thumbnail format as follows:

Thumbnail stored using JPEG encoding
FieldSize (bytes)Description
SOI2FF D8
variableMust be JIF format using YCbCr or just Y, and must not contain JFIF or JFXX segments
EOI2FF D9
Thumbnail stored using one byte per pixel
FieldSize (bytes)Description
Xthumbnail1Horizontal pixel count of the following embedded thumbnail. Must not be zero
Ythumbnail1Vertical pixel count of the following embedded thumbnail. Must not be zero
Thumbnail palette768256 palette entries, each containing a 24 bit RGB color value
Thumbnail datanOne byte per pixel containing the index of the color within the palette,

with n = Xthumbnail × Ythumbnail

Thumbnail stored using three byte per pixel
FieldSize (bytes)Description
Xthumbnail1Horizontal pixel count of the following embedded thumbnail. Must not be zero
Ythumbnail1Vertical pixel count of the following embedded thumbnail. Must not be zero
Thumbnail data3 × nUncompressed 24 bit RGB (8 bits per color channel) raster thumbnail data in the order R0, G0, B0, ... Rn-1, Gn-1, Bn-1; with n = Xthumbnail × Ythumbnail

Compatibility

The newer Exchangeable image file format (Exif) is comparable to JFIF, but the two standards are mutually incompatible. This is because both standards specify that their particular application segment (APP0 for JFIF, APP1 for Exif) must immediately follow the SOI marker. In practice, many programs and digital cameras produce files with both application segments included. This will not affect the image decoding for most decoders, but poorly designed JFIF or Exif parsers may not recognise the file properly.

JFIF is compatible with Adobe Photoshop's JPEG "Information Resource Block" extensions, and IPTC Information Interchange Model metadata, since JFIF does not preclude other application segments, and the Photoshop extensions are not required to be the first in the file. However, Photoshop generally saves CMYK buffers as four-component "Adobe JPEGs" that are not conformant with JFIF. Since these files are not in a YCbCr color space, they are typically not decodable by Web browsers and other Internet software.

History

Development of the JFIF document was led by Eric Hamilton of C-Cube Microsystems, and agreement on the first version was established in late 1991 at a meeting held at C-Cube involving about 40 representatives of various computer, telecommunications, and imaging companies. Shortly afterwards, a minor revision was published — JFIF 1.01. [3] For nearly 20 years, the latest version available was v1.02, published September 1, 1992. [2]

In 1996, RFC 2046 specified that the image format used for transmitting JPEG images across the Internet should be JFIF. The MIME type of "image/jpeg" must be encoded as JFIF. In practice, however, virtually all Internet software can decode any baseline JIF image that uses Y or YCbCr components, whether it is JFIF compliant or not.

As time went by, C-Cube was restructured (and eventually devolved into Harmonic, LSI Logic, Magnum Semiconductor, Avago Technologies, Broadcom, and GigOptix, GigPeak, etc), and lost interest in the document, and the specification had no official publisher until it was picked up by Ecma International and the ITU-T/ISO/IEC Joint Photographic Experts Group around 2009 to avoid it being lost to history and provide a way to formally cite it in standard publications and improve its editorial quality. It was published by ECMA in 2009 as Technical Report number 98 to avoid loss of the historical record, [3] and it was formally standardized by ITU-T in 2011 as its Recommendation T.871 [4] and by ISO/IEC in 2013 as ISO/IEC 10918-5, [5] The newer publications included editorial improvements but no substantial technical changes.

See also

Related Research Articles

<span class="mw-page-title-main">JPEG</span> Lossy compression method for reducing the size of digital images

JPEG is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. JPEG typically achieves 10:1 compression with little perceptible loss in image quality. Since its introduction in 1992, JPEG has been the most widely used image compression standard in the world, and the most widely used digital image format, with several billion JPEG images produced every day as of 2015.

<span class="mw-page-title-main">PNG</span> Family of lossless compression file formats for image files

Portable Network Graphics is a raster-graphics file format that supports lossless data compression. PNG was developed as an improved, non-patented replacement for Graphics Interchange Format (GIF)—unofficially, the initials PNG stood for the recursive acronym "PNG's not GIF".

<span class="mw-page-title-main">JPEG 2000</span> Image compression standard and coding system

JPEG 2000 (JP2) is an image compression standard and coding system. It was developed from 1997 to 2000 by a Joint Photographic Experts Group committee chaired by Touradj Ebrahimi, with the intention of superseding their original JPEG standard, which is based on a discrete cosine transform (DCT), with a newly designed, wavelet-based method. The standardized filename extension is .jp2 for ISO/IEC 15444-1 conforming files and .jpx for the extended part-2 specifications, published as ISO/IEC 15444-2. The registered MIME types are defined in RFC 3745. For ISO/IEC 15444-1 it is image/jp2.

Tag Image File Format or Tagged Image File Format, commonly known by the abbreviations TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word processing, optical character recognition, image manipulation, desktop publishing, and page-layout applications. The format was created by the Aldus Corporation for use in desktop publishing. It published the latest version 6.0 in 1992, subsequently updated with an Adobe Systems copyright after the latter acquired Aldus in 1994. Several Aldus or Adobe technical notes have been published with minor extensions to the format, and several specifications have been based on TIFF 6.0, including TIFF/EP, TIFF/IT, TIFF-F and TIFF-FX.

<span class="mw-page-title-main">Joint Photographic Experts Group</span> Non-profit organisation

The Joint Photographic Experts Group (JPEG) is the joint committee between ISO/IEC JTC 1/SC 29 and ITU-T Study Group 16 that created and maintains the JPEG, JPEG 2000, JPEG XR, JPEG XT, JPEG XS, JPEG XL, and related digital image standards. It also has the responsibility for maintenance of the JBIG and JBIG2 standards that were developed by the former Joint Bi-level Image Experts Group.

<span class="mw-page-title-main">Exif</span> Metadata standard in digital images

Exchangeable image file format is a standard that specifies formats for images, sound, and ancillary tags used by digital cameras, scanners and other systems handling image and sound files recorded by digital cameras. The specification uses the following existing encoding formats with the addition of specific metadata tags: JPEG lossy coding for compressed image files, TIFF Rev. 6.0 for uncompressed image files, and RIFF WAV for audio files. It does not support JPEG 2000 or GIF encoded images.

libjpeg Free software library for handling the JPEG image format

libjpeg is a free library with functions for handling the JPEG image data format. It implements a JPEG codec alongside various utilities for handling JPEG data. It is written in C and distributed as free software together with its source code under the terms of a custom permissive (BSD-like) free software license, which demands attribution. The original variant is maintained and published by the Independent JPEG Group (IJG). Meanwhile, there are several forks with additional features.

Mixed raster content (MRC) is a method for compressing images that contain both binary-compressible text and continuous-tone components, using image segmentation methods to improve the level of compression and the quality of the rendered image. By separating the image into components with different compressibility characteristics, the most efficient and accurate compression algorithm for each component can be applied.

H.262 or MPEG-2 Part 2 is a video coding format standardised and jointly maintained by ITU-T Study Group 16 Video Coding Experts Group (VCEG) and ISO/IEC Moving Picture Experts Group (MPEG), and developed with the involvement of many companies. It is the second part of the ISO/IEC MPEG-2 standard. The ITU-T Recommendation H.262 and ISO/IEC 13818-2 documents are identical.

<span class="mw-page-title-main">Photo CD</span> CD-based format used for storing uncompressed photos

Photo CD is a system designed by Kodak for digitizing and saving photos onto a CD. Launched in 1991, the discs were designed to hold nearly 100 high quality images, scanned prints and slides using special proprietary encoding. Photo CDs are defined in the Beige Book and conform to the CD-ROM XA and CD-i Bridge specifications as well. They were intended to play on CD-i players, Photo CD players, and any computer with a suitable software.

An image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an image file format may be compressed or uncompressed. If the data is compressed, it may be done so using lossy compression or lossless compression. For graphic design applications, vector formats are often used. Some image file formats support transparency.

A camera raw image file contains unprocessed or minimally processed data from the image sensor of either a digital camera, a motion picture film scanner, or other image scanner. Raw files are so named because they are not yet processed, and contain large amounts of potentially redundant data. Normally, the image is processed by a raw converter, in a wide-gamut internal color space where precise adjustments can be made before conversion to a viewable file format such as JPEG or PNG for storage, printing, or further manipulation. There are dozens of raw formats in use by different manufacturers of digital image capture equipment.

JPEG XR is an image compression standard for continuous tone photographic images, based on the HD Photo specifications that Microsoft originally developed and patented. It supports both lossy and lossless compression, and is the preferred image format for Ecma-388 Open XML Paper Specification documents.

Tag Image File Format/Electronic Photography (TIFF/EP) is a digital image file format standard – ISO 12234-2, titled "Electronic still-picture imaging – Removable memory – Part 2: TIFF/EP image data format". This is different from the Tag Image File Format, which is a standard administered by Adobe currently called "TIFF, Revision 6.0 Final – June 3, 1992".

In color management, an ICC profile is a set of data that characterizes a color input or output device, or a color space, according to standards promulgated by the International Color Consortium (ICC). Profiles describe the color attributes of a particular device or viewing requirement by defining a mapping between the device source or target color space and a profile connection space (PCS). This PCS is either CIELAB (L*a*b*) or CIEXYZ. Mappings may be specified using tables, to which interpolation is applied, or through a series of parameters for transformations.

<span class="mw-page-title-main">Rec. 709</span> Standard for HDTV image encoding and signal characteristics

Rec. 709, also known as Rec.709, BT.709, and ITU 709, is a standard developed by ITU-R for image encoding and signal characteristics of high-definition television.

Motion JPEG 2000 is a file format for motion sequences of JPEG 2000 images and associated audio, based on the MP4 and QuickTime format. Filename extensions for Motion JPEG 2000 video files are .mj2 and .mjp2, as defined in RFC 3745.

High Efficiency Image File Format (HEIF) is a container format for storing individual digital images and image sequences. The standard covers multimedia files that can also include other media streams, such as timed text, audio and video.

JPEG XT is an image compression standard which specifies backward-compatible extensions of the base JPEG standard.

JPEG XS is an interoperable, visually lossless, low-latency and lightweight image and video coding system used in professional applications. Applications of the standard include streaming high quality content for virtual reality, drones, autonomous vehicles using cameras, gaming, and broadcasting. In this respect, JPEG XS is unique, being the first ISO codec ever designed for this specific purpose. JPEG XS, built on core technology from both intoPIX and Fraunhofer IIS, is formally standardized as ISO/IEC 21122 by the Joint Photographic Experts Group with the first edition published in 2019. Although not official, the XS acronym was chosen to highlight the eXtra Small and eXtra Speed characteristics of the codec. Today, the JPEG committee is still actively working on further improvements to XS, with the second edition scheduled for publication and initial efforts being launched towards a third edition.

References

  1. 1 2 "Recommendation ITU-T T.81: Information technology – Digital compression and coding of continuous-tone still images – Requirements and guidelines" (PDF). ITU-T (formerly CCITT). 18 February 1992. Retrieved 15 June 2015.
  2. 1 2 Hamilton, Eric (12 September 1992). "JPEG File Interchange Format, Version 1.02" (pdf, 0.02 MB). Retrieved 15 June 2015.
  3. 1 2 "JPEG File Interchange Format (JFIF)". ecma-international.org. 2009. Retrieved 15 June 2015.
  4. "Recommendation ITU-T T.871: Information technology – Digital compression and coding of continuous-tone still images: JPEG File Interchange Format (JFIF)" (PDF). ITU-T. 14 May 2011. Retrieved 15 June 2015.
  5. "ISO/IEC 10918-5:2013: Information technology – Digital compression and coding of continuous-tone still images: JPEG File Interchange Format (JFIF)". ISO/International Electrotechnical Commission. 1 May 2013. Retrieved 15 June 2015.

Further reading

Books

Standards