JPEG libraries
Open-source libraries that decode and encode JPEG files. Almost every image library uses libjpeg-turbo underneath (Pillow, OpenCV, libvips, ImageMagick, GD, Skia); Go, Rust and .NET’s ImageSharp have their own decoders. Things that differ between libraries: whether they apply the Exif orientation, whether they keep metadata when saving, and whether they can write progressive JPEG and choose chroma subsampling.
| Language | Library | Read | Write | Notes |
|---|---|---|---|---|
| C/C++ | libjpeg-turbo | yes | yes | the standard JPEG codec, SIMD-accelerated, libjpeg and TurboJPEG APIs |
| C/C++ | mozjpeg | yes | yes | libjpeg-turbo fork that makes smaller files, slower encoding |
| C/C++ | stb_image | yes | yes | single header, public domain, baseline-only encoder |
| C# | ImageSharp | yes | yes | pure managed code, Exif, progressive; Six Labors Split License |
| C# | SkiaSharp | yes | yes | wrapper of Google’s Skia, fast decode and resize |
| C# | Magick.NET | yes | yes | ImageMagick for .NET, every JPEG option |
| C# | MetadataExtractor | metadata | no | Exif, XMP, IPTC, ICC reading |
| Java | ImageIO | yes | yes | built into the JDK |
| Java | TwelveMonkeys | yes | yes | ImageIO plugin: CMYK, YCCK, broken files |
| Java | metadata-extractor | metadata | no | the standard Exif reader for Java |
| Go | image/jpeg | yes | yes | standard library, baseline encoder, no metadata |
| Go | imaging | yes | yes | resize, crop, auto-orientation |
| Python | Pillow | yes | yes | the standard Python imaging library, Exif |
| Python | OpenCV | yes | yes | images as NumPy arrays |
| Ruby | ruby-vips | yes | yes | fast, low memory thumbnails, libvips binding |
| Ruby | MiniMagick | yes | yes | wraps ImageMagick command line |
| Rust | image | yes | yes | high-level, many formats |
| Rust | zune-jpeg | yes | no | fast pure-Rust decoder used by image |
| PHP | GD | yes | yes | bundled with PHP, Exif via the exif extension |
| PHP | Imagick | yes | yes | ImageMagick extension |
| PHP | Intervention Image | yes | yes | fluent API over GD, Imagick or libvips |
By language#
- JPEG libraries for C/C++ Open-source C/C++ libraries to read and write JPEG images: libjpeg-turbo, mozjpeg and stb_image. Comparison, when to use each, and code examples.
- JPEG libraries for C# Open-source .NET libraries to read and write JPEG images and Exif metadata: ImageSharp, SkiaSharp, Magick.NET and MetadataExtractor. Comparison.
- JPEG libraries for Java Open-source Java libraries to read and write JPEG images and Exif: the built-in ImageIO, the TwelveMonkeys ImageIO plugin and metadata-extractor. Comparison.
- JPEG libraries for Go Open-source Go libraries to read and write JPEG images: the standard image/jpeg package and imaging for resizing and Exif orientation. Comparison.
- JPEG libraries for Python Open-source Python libraries to read and write JPEG images and Exif: Pillow and OpenCV. Comparison, when to use each, and code examples.
- JPEG libraries for Ruby Open-source Ruby libraries to read and write JPEG images: ruby-vips and MiniMagick. Comparison, when to use each, and code examples.
- JPEG libraries for Rust Open-source Rust crates to read and write JPEG images: image and zune-jpeg, plus kamadak-exif for Exif. Comparison, when to use each, and code examples.
- JPEG libraries for PHP Open-source PHP libraries to read and write JPEG images and Exif: GD, Imagick and Intervention Image. Comparison, when to use each, and code examples.