libjpeg

From Wikipedia, the free encyclopedia
(Redirected from Mozjpeg)
Jump to navigation Jump to search
libjpeg
Original authorTom Lane
Developers
  • Independent JPEG Group
  • Guido Vollbeding[1][2]
Initial releaseOctober 7, 1991; 34 years ago (1991-10-07)
Repositorywww.ijg.org/files/
Written inC
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    Operating systemCross-platform
    Typelibrary
    LicenseCustom BSD-like (free software)
    Website

    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.[3]

    Utilities

    [edit | edit source]

    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

    [edit | edit source]
    File:CropGUI GTK small.png
    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:

    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 steps of 90 degrees,
      • cropping or joining at image block borders (every 8×8 or 16×16 pixels),
      • rescaling.[7]

    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.

    History

    [edit | edit source]

    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.[8]

    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

    [edit | edit source]

    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.[9]

    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.[10]

    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,[11] and CloudFlare assigned a developer for the improvement of MozJPEG.[12]

    In 2019, libjpeg-turbo became the ISO and ITU endorsed reference implementation for the JPEG format.[13]

    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.[14]

    Change in IJG leadership

    [edit | edit source]

    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.[15] The changes that were held in prospect after the 6x series were not delivered.[16] 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).[16]

    Versions 8 and 9 served basically for the introduction of controversial[17] incompatible format extensions. These are widely regarded as ineffective and inferior to existing, standardised solutions.[18] 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.[17]

    Versions

    [edit | edit source]
    Version Released New features
    ITU T.81 JPEG Compatible
    Unsupported: 1 1991
    • First release
    • Baseline or optimized JPEG
    • GIF or PPM output
    Unsupported: 2 1991
    • Internal improvements
    • More input/output formats
    Unsupported: 3 1992 Internal and image quality improvements
    Unsupported: 4 1992 Internal and speed improvements
    Unsupported: 4a 1993-02-18
    Unsupported: 5 1994-09-24 Internal improvements and revised API
    Unsupported: 5a 1994-12-07
    Unsupported: 5b 1995-03-15
    Unsupported: 6 1995-08-02
    • Progressive JPEG
    • jpegtran (convert between baseline and progressive)
    Unsupported: 6a 1996-02-07
    Supported: 6b 1998-03-27
    • jpegtran extended to lossless rotate

    (used by libjpeg-turbo, MozJPEG and Jpegli)

    Unsupported: 7 2009-06-27
    • jpegtran extended to lossless crop
    • T.851 Arithmetic Coding[19]
    • Scaled DCT[20]
    Proprietary non-compatible extensions
    Unsupported: 8 2010-01-10
    • SmartScale extension (ITU rejected)[21][22]
    • jpegtran extended to use SmartScale
    • Internal fixes
    Unsupported: 8a 2010-02-28 RGBA
    Unsupported: 8b 2010-05-16 Memory corruption & build fixes
    Unsupported: 8c 2011-01-16 Option for selecting DCT block size (SmartScale)
    Unsupported: 8d 2012-01-15 RGB JPEG (no color transform to YCbCr)
    Unsupported: 9 2013-01-13
    • YCoCg color
    • Lossless compression (1x1 DCT)[23]
    Unsupported: 9a 2014-01-19
    • "JFIFv2" scRGB Wide color gamut (standard unknown)
    • 8-12 bit color (standardJPEG)
    Unsupported: 9b 2016-01-17 Computation improvements
    Unsupported: 9c 2018-01-14 jpegtran -wipe
    Unsupported: 9d 2020-01-12
    • Code cleanup
    • Huffman optimization
    • x64 support (MSVC)
    • jpegtran -drop
    Unsupported: 9e 2022-01-16 ARM and ARM64 support (MSVC)
    Latest version: 9f 2024-01-14
    • ARM64EC support (MSVC)
    • Xcode build system
    • C++Builder/RAD Studio build system
    Legend:
    Unsupported
    Supported
    Latest version

    Forks

    [edit | edit source]

    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.[24]

    libjpeg-turbo

    [edit | edit source]
    libjpeg-turbo
    Developerlibjpeg-turbo Project
    Initial releaseNovember 19, 2010; 15 years ago (2010-11-19)
    Repositorygithub.com/libjpeg-turbo
    Engine
      Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
      Websitelibjpeg-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 Linux distributions (Fedora, Debian, Mageia, openSUSE, ...), Mozilla, and Chrome.[25][26][27] 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.[28] libjpeg v7, v8 and v9 broke ABI compatibility with prior releases.[15]

      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.[29] libjpeg-turbo chooses not to support SmartScale, because it is not an ITU-T standard and because their own research finds it (and DCT scaling) ineffective.[20] 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.[citation needed]

      Since 2019, libjpeg-turbo is one of the two JPEG reference implementations, available as ISO/IEC 10918-7 and ITU-T T.873.[13] The other reference implementation is ISO libjpeg which also includes support for JPEG XT and JPEG LS.[citation needed]

      MozJPEG

      [edit | edit source]
      MozJPEG
      DeveloperMozilla Research
      Initial releaseMarch 4, 2014; 12 years ago (2014-03-04)
      Stable release
      4.1.5 / October 12, 2023; 2 years ago (2023-10-12)[30]
      Repository
      • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
      Engine
        Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
        Websitegithub.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 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.[citation needed]

        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.[citation needed]

        Besides libjpeg-turbo, MozJPEG also builds upon jpegcrush, a Perl script by Loren Merritt.[10][31]

        Jpegli

        [edit | edit source]
        Jpegli
        DeveloperGoogle
        Initial releaseNovember 14, 2020; 5 years ago (2020-11-14)
        Stable release
        0.11.0[32] / September 13, 2024; 22 months ago (2024-09-13)
        Repository
        • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
        Engine
          Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
          Websitegithub.com/google/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.[33]

          ISO libjpeg

          [edit | edit source]

          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).[34] 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

          [edit | edit source]

          Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal').

          References

          [edit | edit source]
          1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          3. ^ JPEG JFIF
          4. ^ Jpegcrop Preferences and Options description
          5. ^ Filmic Games >> The greatest failure of our patent system was... Archived 2012-09-01 at the Wayback Machine
          6. ^ 680385 - Firefox does not show arithmetic coded jpegs
          7. ^ New jpegtran features
          8. ^ JPEG homepage
          9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          10. ^ a b André Kramer (heise.de-Newsticker), January 14, 2013: Mozilla-Encoder verbessert JPEG-Kompression
          11. ^ Sebastian Grüner, 16. Juli 2014: MozJPEG 2.0: Facebook unterstützt JPEG-Encoder von Mozilla
          12. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          13. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          14. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          15. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          16. ^ a b Mans Rullgard (Hardwarebug.org), August 4, 2009: IJG is back Archived 2014-07-16 at the Wayback Machine
          17. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          18. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          19. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          20. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          21. ^ ITU-T JPEG-Plus Proposal R3
          22. ^ Evolution of JPEG
          23. ^ JPEG 9 Lossless Coding
          24. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          25. ^ Software That Uses or Provides libjpeg-turbo. February 9, 2012.
          26. ^ Issue 48789 – chromium – Use libjpeg-turbo instead of libjpeg. April 14, 2011.
          27. ^ Bug 698519 – Update to libjpeg-turbo 1.2. February 28, 2012
          28. ^ libjpeg for F14. February 9, 2012.
          29. ^ libjpeg-turbo README file Archived 2018-12-14 at the Wayback Machine
          30. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          31. ^ Andreas Donath (golem.de), March 6, 2014: Mozilla will JPEGs besser komprimieren
          32. ^ Jpegli Changelog
          33. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          34. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
          [edit | edit source]
          • JPEG FAQs
          • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).