Skip to content
/ image Public

image/jpeg base pure go image utility.

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
BSD-3-Clause
LICENSE-go
Unknown
LICENSE-imagemagick
Notifications You must be signed in to change notification settings

go-oss/image

image

image/jpeg base pure go image utility.

Go Reference Test codecov Maintainability Go Report Card

features

  • Decode jpeg with quality value.
  • Apply EXIF orientation to image pixels.

compatibility

  • Go 1.13+

usage

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

example

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)
}