libjpeg
Developer(s) | Independent JPEG Group |
---|---|
Initial release | October 7, 1991 |
Stable release | 9c
/ January 14, 2018 |
Written in | C |
Operating system | Cross-platform |
Type | library |
License | Custom BSD-like (free software) |
Website | ijg |
libjpeg is a free library with functions for handling the JPEG image data format. It implements a JPEG codec (encoding and decoding) 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.
JPEG JFIF images are widely used on the Web. The amount of compression can be adjusted to achieve the desired trade-off between file size and visual quality.[1]
Utilities
The following utility programs are shipped together with libjpeg:
- cjpeg and djpeg
- for performing conversions between JPEG and some other popular image file formats.
- rdjpgcom and wrjpgcom
- for inserting and extracting textual comments in JPEG files.
- jpegtran
- for transformation of existing JPEG files.
jpegtran
The command-line program jpegtran provides several features for reformatting and recoding the representation of the DCT coefficients, for transformation of actual image data and for discarding auxiliary data in JPEG files, respectively. The transformations regarding the representation of the coefficients comprise:
- optimisation of the Huffman coding layer of a JPEG file to increase compression,
- conversion between progressive and sequential JPEG formats,
- conversion between Huffman and arithmetic coding in the entropy coding layer.[2][3][4]
These transformations are each completely lossless and reversible. The transformations on the image data comprise:
- eliminate non-standard application-specific data inserted by some image programs,
- perform certain transformations on a file, such as:
These are lossless and reversible only regarding the image data that is kept. Reencoding with repeated lossy quantisation of the image data (generation loss) does not take place.
There is an associated Windows application, Jpegcrop, which provides a user interface to jpegtran. For Unix-like systems like Linux there is the free CropGUI with similar functionality. More programs supporting JPEG lossless transformation functions based on the IJG code are given on the Lossless Applications List.
History
The JPEG implementation of the Independent JPEG Group (IJG) was first publicly released on 7 October 1991 and has been considerably developed since that time. The development was initially mainly done by Tom Lane. The open-source implementation of the IJG was one of the major open-source packages and was key to the success of the JPEG standard. Many companies incorporated it into a variety of products such as image editors and web browsers.[6]
For version 5, which was released on September 24, 1994, the whole code base was rewritten. It introduced the utility programs rdjpgcom and wrjpgcom for handling embedded text comments. The version 6 from 2 August 1995 came with support for progressive JPEG and for the first time with the utility program jpegtran. This utility was extended with features to rotate and flip images and grayscale reduction in version 6b.
From version 6b of libjpeg of 27 March 1998, Miyasaka Masaru forked a branch named libjpeg/SIMD, which included x86 SIMD optimisations. It got substantial contributions from the TigerVNC and the VirtualGL projects in 2009. On that basis the libjpeg-turbo project was created in 2010.[7]
After 11 years and a change in leadership, the IJG released new versions of libjpeg (7 through 9), of which each broke ABI compatibility with previous versions.[8] The changes that were held in prospect after the 6x series were not delivered.[9]
In version 7, support for arithmetic coding was introduced, which earlier has been rejected because of the patent situation, as well as the crop feature in jpegtran (-crop
).[9]
Versions 8 and 9 served basically for the introduction of controversial[10] incompatible format extensions. These are widely regarded as ineffective and inferior to existing, standardised solutions.[11][12] Their standardisation was rejected after submission to the ITU-T. The original organiser Tom Lane and others criticize these changes as a break from the goals of the IJG.[10]
On 4 March 2014, the first version of the filesize-optimising fork mozjpeg was published. For this version Josh Aas from Mozilla Research reworked the Perl script jpegcrush from x264's main developer Loren Merritt and integrated it into the code base of libjpeg-turbo.[13]
On 10 July 2014, Mozilla released version 2.0, which mainly added trellis quantisation and is now able to reduce the size of baseline JPEGs also. Facebook, Inc. donated 60000 dollars for the development of the next version,[14] and CloudFlare assigned a developer for the improvement of mozjpeg.[15]
Versions
Version | Released | New features | |
---|---|---|---|
ITU T.81 JPEG Compatible | |||
1 | 1991 | First release Baseline or optimized JPEG GIF or PPM output | |
2 | 1991 | Internal improvements More input/output formats | |
3 | 1992 | Internal and image quality improvements | |
4 | 1992 | Internal and speed improvements | |
4a | 1993-02-18 | ||
5 | 1994-09-24 | Internal improvements and revised API | |
5a | 1994-12-07 | ||
5b | 1995-03-15 | ||
6 | 1995-08-02 | Progressive JPEG jpegtran (convert between baseline and progressive) | |
6a | 1996-02-07 | ||
6b | 1998-03-27 | jpegtran extended to lossless rotate | |
Proprietary non-compatible extensions | |||
7 | 2009-06-27 | jpegtran extended to lossless crop | |
8 | 2010-01-10 | Internal fixes jpegtran extended to use SmartScale | |
8a | 2010-02-28 | RGBA | |
8b | 2010-05-16 | ||
8c | 2011-01-16 | Variable DCT block size | |
8d | 2012-01-15 | RGB JPEG (no color transform to YCbCr) | |
9 | 2013-01-13 | YCoCg color Lossless compression[19] | |
9a | 2014-01-19 | Wide color gamut (JFIF v2) 8-12 bit color | |
9b | 2016-01-17 | ||
9c | 2018-01-14 |
Legend: | Old version, not maintained | Current stable version |
---|
Forks
Well-known forks are libjpeg-turbo, which optimises for speed of execution, and mozjpeg, which optimises for smaller file sizes.
There is also a similarly named library from the ISO, which aims to be a complete implementation of JPEG, JPEG XT and JPEG-LS standards.[20]
libjpeg-turbo
Developer(s) | libjpeg-turbo Project |
---|---|
Initial release | 2010 |
Stable release | 1.5.3
/ May 22, 2018 |
Website | libjpeg-turbo.org |
libjpeg-turbo is a fork of libjpeg that uses SIMD instructions to accelerate baseline JPEG encoding and decoding. Many projects are now using libjpeg-turbo instead of libjpeg, including popular GNU/Linux distributions (Fedora, Debian, Mageia, openSUSE, ...), Mozilla, and Chrome.[21][22][23] Apart from performance, some projects have chosen to use libjpeg-turbo because it allows them to retain backward ABI compatibility with the older libjpeg v6b release.[24] libjpeg v7, v8 and v9 broke ABI compatibility with prior releases.[8]
libjpeg-turbo can be configured to be compatible with the libjpeg v7 or v8 ABI, but it does not implement the complete set of features in recent IJG releases, including the SmartScale format extension.[25] The libjpeg-turbo Project has chosen not to support SmartScale, citing concerns regarding the fact that it is not an ITU-T standard and citing their own research that questions the usefulness of the feature. By extension, since the only major new feature in libjpeg v9 is specific to the SmartScale format, the libjpeg-turbo Project has chosen to forgo emulating libjpeg v9.[11] Therefore, SmartScale files created by libjpeg v8 and later will not be decompressed correctly by libjpeg-turbo.
mozjpeg
Developer(s) | Mozilla Research |
---|---|
Initial release | March 4, 2014 |
Stable release | 3.3.1
/ March 17, 2018 |
Website | github.com/mozilla/mozjpeg |
mozjpeg is a fork from libjpeg-turbo done by Josh Aas and others from Mozilla Research. It aims to speed up loading times of webpages by achieving a reduction in file size (of about 10%) and therefore transmission time through improvement of coding efficiency at unchanged image quality. To achieve this, it uses more processing power for the encoding (asymmetry) while retaining full compatibility with the JPEG standard and requiring no changes on the decoder side. It is actually done by optimising Huffman trees, using progressive coding with optimised splitting of the spectrum of DCT coefficients into separate scans and through the use of trellis quantisation. Additionally, the presets are aggressively tuned towards the minimisation of file sizes. Besides libjpeg-turbo, mozjpeg builds also on jpegcrush, a Perl script by Loren Merritt.[13][26]
ISO libjpeg
Developer(s) | Thomas Richter /JPEG Reference AhG |
---|---|
Initial release | July 27, 2012 |
Stable release | 1.53
/ May 18, 2017 |
Website | github.com/thorfdbg/libjpeg |
ISO/IEC Joint Photography Experts Group maintains a reference software implementation for base JPEG (ISO/IEC 10918-1 and 18477-1) and JPEG XT extensions (ISO/IEC 18477 Parts 2 and 6-9), as well as lossless JPEG-LS (ISO/IEC 14495).[27]. Though also named libjpeg, it is not related to the source code provided by Independent JPEG Group (IJG) and does not support proprietary extensions introduced by IJG since 2007.
See also
References
- ^ JPEG JFIF
- ^ Jpegcrop Preferences and Options description
- ^ Filmic Games >> The greatest failure of our patent system was... Archived 2012-09-01 at the Wayback Machine
- ^ 680385 - Firefox does not show arithmetic coded jpegs
- ^ New jpegtran features
- ^ JPEG homepage
- ^ http://libjpeg-turbo.virtualgl.org/
- ^ a b "libjpeg: API/ABI changes review". Retrieved 2017-10-28.
- ^ a b Mans Rullgard (Hardwarebug.org), August 4, 2009: IJG is back
- ^ a b Tom Lane, January 16, 2013: jpeg-9, API/ABI compatibility, and the future role of this project
- ^ a b "What About libjpeg v9?". libjpeg-turbo team. Retrieved February 8, 2013.
- ^ Mans Rullgard (Hardwarebug.org), February 1, 2010: IJG swings again, and misses
- ^ a b André Kramer (heise.de-Newsticker), January 14, 2013: Mozilla-Encoder verbessert JPEG-Kompression
- ^ Sebastian Grüner, 16. Juli 2014: mozjpeg 2.0: Facebook unterstützt JPEG-Encoder von Mozilla
- ^ http://www.soeren-hentzschel.at/mozilla/2014/07/30/cloudflare-moechte-zu-mozillas-jpeg-encoder-beitragen/
- ^ "ITU-T T.81 (JPEG-1)-based still-image coding using an alternative arithmetic coder" (pdf). September 2009.
- ^ ITU-T JPEG-Plus Proposal R3
- ^ Evolution of JPEG
- ^ JPEG 9 Lossless Coding
- ^ https://github.com/thorfdbg/libjpeg
- ^ Software That Uses or Provides libjpeg-turbo. February 9, 2012.
- ^ Issue 48789 – chromium – Use libjpeg-turbo instead of libjpeg. April 14, 2011.
- ^ Bug 698519 – Update to libjpeg-turbo 1.2. February 28, 2012
- ^ libjpeg for F14. February 9, 2012.
- ^ libjpeg-turbo README file Archived 2014-08-12 at the Wayback Machine
- ^ Andreas Donath (golem.de), March 6, 2014: Mozilla will JPEGs besser komprimieren
- ^ https://jpeg.org/jpegxt/software.html
External links
- Official website of the Independent JPEG Group
- JPEG FAQs
- JPEGclub – Additional features for libjpeg
- Binary package of libjpeg for Windows (at GnuWin32 in SourceForge.net)
- libjpeg-turbo, an ABI-/API-compatible fork of libjpeg that uses x86 SIMD instructions to achieve a substantial speedup over the reference implementation.
- mozjpeg - the filesize-optimising fork on GitHub
- Josh Aas, Robert Nyman; August 2014: Using mozjpeg to Create Efficient JPEGs – practical overview over mozjpeg