JPEG libraries for Go
- image/jpeg is in the standard library: pure Go, decodes baseline and progressive JPEG, encodes baseline with a quality setting. It ignores all metadata (no Exif orientation, no ICC profile) and always writes 4:2:0 subsampling. Enough for most servers and tools.
- imaging (
github.com/disintegration/imaging) adds resizing, cropping, rotation and filters on top ofimage/jpeg, and can apply the Exif orientation when opening a file. It’s stable but no longer actively developed.
For Exif tags, use goexif (BSD-2) or dsoprea/go-exif (MIT). For speed or progressive encoding, bind libjpeg-turbo or libvips through cgo, e.g. bimg or govips.
- image/jpeg Go's standard image/jpeg package decodes and encodes JPEG with no dependencies. How to read and write JPEG, set the quality, get dimensions without decoding.
- imaging imaging is a Go image processing package on top of image/jpeg. How to open JPEG with Exif auto-orientation, resize, crop and make thumbnails.