HOME

TheInfoList



OR:

libjpeg is a free
library A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
with functions for handling the
JPEG JPEG ( , short for Joint Photographic Experts Group and sometimes retroactively referred to as JPEG 1) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degr ...
image data format. It implements a JPEG
codec A codec is a computer hardware or software component that encodes or decodes a data stream or signal. ''Codec'' is a portmanteau of coder/decoder. In electronic communications, an endec is a device that acts as both an encoder and a decoder o ...
(encoding and decoding) alongside various utilities for handling JPEG data. It is written in C and distributed as
free software Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
together with its
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
under the terms of a custom permissive (
BSD The Berkeley Software Distribution (BSD), also known as Berkeley Unix or BSD Unix, is a discontinued Unix operating system developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berkeley, beginni ...
-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 In cutlery or kitchenware, a fork (from 'pitchfork') is a Eating utensil, utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tine (structural), tines with whic ...
with additional features. JPEG
JFIF 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 Digital container format, container format that contains the image ...
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.


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 A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
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 In computer science and information theory, a Huffman code is a particular type of optimal prefix code that is commonly used for lossless data compression. The process of finding or using such a code is Huffman coding, an algorithm developed by ...
layer of a JPEG file to increase compression, * conversion between progressive and sequential JPEG formats, * conversion between Huffman and
arithmetic coding Arithmetic coding (AC) is a form of entropy encoding used in lossless data compression. Normally, a String (computer science), string of characters is represented using a fixed number of bits per character, as in the American Standard Code for In ...
in the
entropy coding In information theory, an entropy coding (or entropy encoding) is any lossless data compression method that attempts to approach the lower bound declared by Shannon's source coding theorem, which states that any lossless data compression method ...
layer. 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: ** discarding of colour channels (conversion to greyscale), ** rotating and
flipping In finance, flipping is purchasing an asset to quickly resell (or "flip") it for profit. Within the real estate industry, the term is used by investors to describe the process of buying, rehabbing, and selling properties for profit. In 2017, 207, ...
in steps of 90 degrees, ** cropping or joining at image block borders (every 8×8 or 16×16 pixels), ** rescaling. These are
lossless Lossless compression is a class of data compression that allows the original data to be perfectly reconstructed from the compressed data with no loss of information. Lossless compression is possible because most real-world data exhibits statisti ...
and reversible only regarding the image data that is kept. Reencoding with repeated lossy quantisation of the image data (
generation loss Generation loss is the loss of quality between subsequent copies or transcodes of data. Anything that reduces the quality of the representation when copying, and would cause further reduction in quality on making a copy of the copy, can be con ...
) does not take place.


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 Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
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. 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.


libjpeg-turbo and descendants

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. 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 Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Perl was developed ...
script ''jpegcrush'' from
x264 x264 is a free and open-source software library and a command-line utility developed by VideoLAN for encoding video streams into the H.264/MPEG-4 AVC video coding format. It is released under the terms of the GNU General Public License. Histo ...
's main developer Loren Merritt and integrated it into the code base of libjpeg-turbo. 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 Facebook is a social media and social networking service owned by the American technology conglomerate Meta Platforms, Meta. Created in 2004 by Mark Zuckerberg with four other Harvard College students and roommates, Eduardo Saverin, Andre ...
, Inc. donated for the development of the next version, and
CloudFlare Cloudflare, Inc., is an American company that provides content delivery network services, cybersecurity, DDoS mitigation, wide area network services, reverse proxies, Domain Name Service, ICANN-accredited domain registration, and other se ...
assigned a developer for the improvement of MozJPEG. In 2019, libjpeg-turbo became the ISO and ITU endorsed reference implementation for the JPEG format. In April 2024, Google introduced ''Jpegli'', a new JPEG coding library that offers enhanced capabilities and a 35% compression ratio improvement at high quality compression settings, while the coding speed is comparable with MozJPEG.


Change in IJG leadership

After 11 years and a change in leadership, the IJG under Guido Vollbeding released new versions of libjpeg (7 through 9), of which each broke ABI compatibility with previous versions. The changes that were held in prospect after the 6x series were not delivered. In version 7, support for
arithmetic coding Arithmetic coding (AC) is a form of entropy encoding used in lossless data compression. Normally, a String (computer science), string of characters is represented using a fixed number of bits per character, as in the American Standard Code for In ...
was introduced, which earlier has been rejected because of the
patent A patent is a type of intellectual property that gives its owner the legal right to exclude others from making, using, or selling an invention for a limited period of time in exchange for publishing an sufficiency of disclosure, enabling discl ...
situation, as well as the crop feature in jpegtran (-crop). Versions 8 and 9 served basically for the introduction of controversial incompatible format extensions. These are widely regarded as ineffective and inferior to existing, standardised solutions. Their standardisation was rejected after submission to the
ITU-T The International Telecommunication Union Telecommunication Standardization Sector (ITU-T) is one of the three Sectors (branches) of the International Telecommunication Union (ITU). It is responsible for coordinating Standardization, standards fo ...
. The original organiser Tom Lane and others criticize these changes as a break from the goals of the IJG.


Versions


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 The International Organization for Standardization (ISO ; ; ) is an independent, non-governmental, international standard development organization composed of representatives from the national standards organizations of member countries. Me ...
, which aims to be a complete implementation of JPEG, JPEG XT and
JPEG LS Lossless JPEG is a 1993 addition to JPEG standard by the Joint Photographic Experts Group to enable lossless compression. However, the term may also be used to refer to all lossless compression schemes developed by the group, including JPEG 2000, J ...
standards.


libjpeg-turbo

libjpeg-turbo is a fork of libjpeg that uses
SIMD Single instruction, multiple data (SIMD) is a type of parallel computer, parallel processing in Flynn's taxonomy. SIMD describes computers with multiple processing elements that perform the same operation on multiple data points simultaneousl ...
instructions to accelerate baseline JPEG encoding and decoding. Many projects are now using libjpeg-turbo instead of libjpeg, including popular Linux distributions ( Fedora,
Debian Debian () is a free and open-source software, free and open source Linux distribution, developed by the Debian Project, which was established by Ian Murdock in August 1993. Debian is one of the oldest operating systems based on the Linux kerne ...
,
Mageia Mageia is a Linux-based operating system, distributed as free and open-source software. It was forked from the Mandriva Linux distribution. The Greek term () means enchantment, fascination, glamour, wizardry. The first release of the software ...
,
openSUSE openSUSE () is a free and open-source software, free and open-source Linux distribution developed by the openSUSE project. It is offered in two main variations: ''Tumbleweed'', an upstream rolling release distribution, and ''Leap'', a stable r ...
, ...),
Mozilla Mozilla is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, publishes and supports Mozilla products, thereby promoting free software and open standards. The community is supported institution ...
, and Chrome. 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. libjpeg v7, v8 and v9 broke ABI compatibility with prior releases. libjpeg-turbo implements the standard-compliant arithmetic coding and lossless crop features seen in libjpeg v7. It can also be configured to be compatible with the libjpeg v7 or v8 ABI, but it does implement DCT scaling and the proprietary SmartScale, which builds on DCT scaling. libjpeg-turbo chooses not to support SmartScale, because it is not an
ITU-T The International Telecommunication Union Telecommunication Standardization Sector (ITU-T) is one of the three Sectors (branches) of the International Telecommunication Union (ITU). It is responsible for coordinating Standardization, standards fo ...
standard and because their own research finds it (and DCT scaling) ineffective. 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. Since 2019, libjpeg-turbo is one of the two JPEG reference implementations, available as ISO/IEC 10918-7 and ITU-T T.873. The other reference implementation is ISO libjpeg which also includes support for JPEG XT and JPEG LS.


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 while retaining 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. The techniques MozJPEG uses to achieve high compression include optimising Huffman trees, using progressive coding to optimally split 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 also builds upon jpegcrush, a
Perl Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Perl was developed ...
script by Loren Merritt.


Jpegli

In April 2024, Google introduced ''Jpegli'', a new JPEG coding library that offers enhanced capabilities and a 35% compression ratio improvement at high quality compression settings, while the coding speed is comparable with MozJPEG.


ISO libjpeg

ISO/IEC Joint Photography Experts Group maintains a reference software implementation for base
JPEG JPEG ( , short for Joint Photographic Experts Group and sometimes retroactively referred to as JPEG 1) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degr ...
(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 Lossless JPEG is a 1993 addition to JPEG standard by the Joint Photographic Experts Group to enable lossless compression. However, the term may also be used to refer to all lossless compression schemes developed by the group, including JPEG 200 ...
(ISO/IEC 14495). It also includes some of the optimizations of MozJPEG. 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

* Lossless editing * The Guetzli JPEG encoder


References


External links


JPEG FAQs
* {{cite web , first1= Robert , last1= Nyman , first2= Josh , last2= Aas , date= Aug 6, 2014 , url= https://hacks.mozilla.org/2014/08/using-mozjpeg-to-create-efficient-jpegs/ , title= Using MozJPEG to Create Efficient JPEGs , publisher= Mozilla , work= Hacks JPEG Graphics libraries C (programming language) libraries Free software programmed in C