image/jpeg
base pure go image utility.
- Decode jpeg with quality value.
- Apply EXIF orientation to image pixels.
- Go 1.13+
To install imageutil
package:
go get github.com/go-oss/image/imageutil
Or, just use jpeg
package:
go get github.com/go-oss/image/jpeg
img, err := imageutil.Decode(reader)
if err != nil {
log.Fatal(err)
}
// print metadata
fmt.Printf("Original MIME Type: %s", img.OriginalMIMEType)
fmt.Printf("Original Image Quality: %d", img.Quality)
// crop square
img.FitCrop()
// encode to jpeg image same original image quality
err = img.EncodeJPEG(ioutil.Discard)
if err != nil {
log.Fatal(err)
}