orientation

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 11 Imported by: 0

README

Exif rotation found in tiff images can cause errors when reading images through code if not handled properly as seen in this reference: https://sirv.com/help/articles/rotate-photos-to-be-upright/

This helper builds on top of two libraries:

github.com/disintegration/imaging and github.com/rwcarlsen/goexif/exif

go get -u github.com/disintegration/imaging
go get -u github.com/rwcarlsen/goexif/exif

and provides a function:

func ReadImage(fpath string) *image.Image

which replaces the original image with a copy of referenced image (jpg, png or gif). The replaced copy has all necessary operation, which are needed to reverse its orientation to 1, applied. The result is a image with corrected orientation and without exif data.

Testing

Tests can be run by running go test on console

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExif added in v1.2.0

func GetExif(imgBody []byte, logger *logrus.Entry, imageId string) *exif.Exif

func GetExifOrientation added in v1.2.0

func GetExifOrientation(exifData *exif.Exif) (string, error)

func ReadImage

func ReadImage(imgBody []byte, logger *logrus.Entry, imageId string) (imagebody []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL