Documentation ¶
Overview ¶
This package exposes an interface for "normalizing" JPEG images that have their orientation EXIF encoded. This library was designed for working with images uploaded from phone cameras that usually have their orientation tagged, which results in a rotated/mirrored images when using the Go image/jpeg library. Supports little-endian and big-endian EXIF encodings, as well as all possible tag transformations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NoExifError error = errors.New("The given file does not contain any EXIF orientation information.")
Functions ¶
func GetOrientationTag ¶
func GetOrientationTag(r io.ReadSeeker) (uint16, error)
GetOrientationTag produces a value between 1 and 8, inclusive, for a given JPEG image in r. This value describes the transformations required to produce the correct image. The excellent article by Magnus Hoff covers this in more detail:
func Normalize ¶
func Normalize(r io.ReadSeeker, w io.Writer) error
Normalize is the "quick-fix" function of this package. It requires an io.ReadSeeker since it needs to detect the orientation and then decode the image. It will write the orientation-corrected image to w. If the JPEG image in r does not have EXIF data or does not have orientation data, r is simply copied to w. When finished, the internal position in r will be at io.SeekStart.
Types ¶
This section is empty.