World Library  
Flag as Inappropriate
Email this Article


Article Id: WHEBN0000633114
Reproduction Date:

Title: Libjpeg  
Author: World Heritage Encyclopedia
Language: English
Subject: IJG (disambiguation), DevIL, GDCM, Preparing images for upload, Graphics libraries
Collection: C Libraries, Free Software Programmed in C, Graphics Libraries
Publisher: World Heritage Encyclopedia


Logo IJG libjpeg v9
Developer(s) Independent JPEG Group
Initial release October 7, 1991 (1991-10-07)
Stable release 9a / January 19, 2014 (2014-01-19)
Development status active
Written in C
Operating system Cross-platform
Type library
License Custom BSD-like (free software)

libjpeg is a widely used 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 basically demands attribution. The original variant is maintained and published by the Independent JPEG Group (IJG). Meanwhile, there are several mostly compatible forks with additional features like for example increased coding efficiency.

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 1
    • jpegtran 1.1
  • History 2
    • Summary 2.1
    • Timeline 2.2
  • Forks 3
    • libjpeg-turbo 3.1
    • mozjpeg 3.2
  • See also 4
  • References 5
  • External links 6


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, and
a utility for transformation of existing JPEG files.


jpegtran transforms JPEG data without reencoding
(here with user interface CropGUI)

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 and
  • conversion between progressive and sequential JPEG formats as well as
  • 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, or
  • to perform certain transformations on a file, such as:
    • discarding of colour channels (conversion to greyscale),
    • rotating and flipping in steps of 90 degrees,
    • cropping at image block borders (every 8×8 or 16×16 pixels), and
    • rescaling.[5]

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 GNU/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.


The JPEG implementation of the Independent JPEG Group (IJG) was first publicly released on the 7th of October 1991, and has been considerably developed since that time. The development was initially mainly done by Tom Lane. The Open Source software 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 the 24th of September 1994, the whole code base was rewritten. It introduced the utility programs rdjpgcom and wrjpgcom for handling embedded text comments. The version 6 from the 2nd of 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 March 27, 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 eleven 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 talk about a break in the goals of the IJG.

On March 4, 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 July 10, 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 60.000 dollars for the development of the next version[14] and CloudFlare assigned a developer for the improvement of mozjpeg.[15]


There are currently two conditions which trigger a major version bump of the JPEG library:

  1. New types of files can be created which are not compatible with prior releases, and
  2. Changes in the master records which break the binary compatibility (usually addition of entries for new functions).

In all major upgrades since v6 both conditions 1. and 2. came together, while the source compatibility (API) could largely be retained.

Major version New file format feature New master record entries References
Old version, no longer supported: 6 progressive JPEG support progressive_mode ... ITU-T Recommendation T.81
ISO/IEC IS 10918-1
Old version, no longer supported: 7 arithmetic coding support scale_num/scale_denom for
compression (encoding) ...
ITU-T JPEG-Plus Proposal ...[16]
Old version, no longer supported: 8 SmartScale
(variable block size)
block_size/lim_Se etc. Evolution of JPEG[17]
Current stable version: 9 internal color transform
(FF F8 LSE extension marker)
color_transform JPEG 9 Lossless Coding[18]
InfAI JPEG Development Site[19]
Legend: Old version Older version, still supported Current version Latest preview version Future release

For version 7 both conditions were different subjects (arith_code entry already existed), other versions are same subject.



More well-known forks are libjpeg-turbo, which optimises for speed of execution, and mozjpeg, which optimises for smaller file sizes. Beside these there is also a libjpeg from the ISO, which aims to be a complete implementation of all JPEG 1 standards.[20]


Logo libjpeg-turbo
Developer(s) libjpeg-turbo Project
Initial release 2010 (2010)
Stable release 1.4.2 / September 21, 2015 (2015-09-21)
Development status active

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

  • Website of the Independent JPEG Group
  • JPEGclub – Additional features for libjpeg
  • Binary package of libjpeg for Windows (at GnuWin32 in
  • 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
  • Josh Aas, Robert Nyman; August 2014: Using mozjpeg to Create Efficient JPEGs – practical overview over mozjpeg

External links

  1. ^ JPEG JFIF
  2. ^ Jpegcrop Preferences and Options description
  3. ^ Filmic Games >> The greatest failure of our patent system was...
  4. ^ 680385 - Firefox does not show arithmetic coded jpegs
  5. ^ New jpegtran features
  6. ^ JPEG homepage
  7. ^
  8. ^ a b libjpeg: API changes/compatibility. February 9, 2012
  9. ^ a b Mans Rullgard (, August 4, 2009: IJG is back
  10. ^ Tom Lane, January 16, 2013: jpeg-9, API/ABI compatibility, and the future role of this project
  11. ^ a b
  12. ^ Mans Rullgard (, February 1, 2010: IJG swings again, and misses
  13. ^ a b André Kramer (, January 14, 2013: Mozilla-Encoder verbessert JPEG-Kompression
  14. ^ Sebastian Grüner, 16. Juli 2014: mozjpeg 2.0: Facebook unterstützt JPEG-Encoder von Mozilla
  15. ^
  16. ^ Contributed document - Word .doc file: ITU-T JPEG-Plus Proposal R3
  17. ^ Contributed document - Word .doc file: Evolution of JPEG
  18. ^ Contributed document - Word .doc file: JPEG 9 Lossless Coding
  19. ^ News c't magazine 2012 issue 18 page 43, Software Links
  20. ^
  21. ^ Software That Uses or Provides libjpeg-turbo. February 9, 2012.
  22. ^ Issue 48789 – chromium – Use libjpeg-turbo instead of libjpeg. April 14, 2011.
  23. ^ Bug 698519 – Update to libjpeg-turbo 1.2. February 28, 2012
  24. ^ libjpeg for F14. February 9, 2012.
  25. ^ libjpeg-turbo README file
  26. ^ Andreas Donath (, March 6, 2014: Mozilla will JPEGs besser komprimieren


See also

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]

mozjpeg tries several partitionings of the spectrum of DCT coefficients
Developer(s) Mozilla Research
Initial release March 4, 2014 (2014-03-04)
Stable release 3.1 / May 18, 2015 (2015-05-18)
Development status active


Therefore, SmartScale files created by libjpeg v8 and later will not be decompressed correctly by libjpeg-turbo. [11]

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.