Documentation
¶
Overview ¶
Package imagemanipulator resizes, crops, rotates and flips pictures, and encodes them again. It's plain Go, so it needs no plugin add, and runs the same on phones, on the web and on your server.
img, err := imagemanipulator.Decode(photo.Data) img = imagemanipulator.Fit(img, 1200) img = imagemanipulator.Rotate(img, 90) jpeg, err := imagemanipulator.JPEG(img, 85)
Index ¶
- func Crop(img image.Image, x, y, w, h int) image.Image
- func Decode(b []byte) (image.Image, error)
- func Fit(img image.Image, max int) image.Image
- func Flip(img image.Image, vertical bool) image.Image
- func JPEG(img image.Image, quality int) ([]byte, error)
- func PNG(img image.Image) ([]byte, error)
- func Resize(img image.Image, w, h int) image.Image
- func Rotate(img image.Image, degrees int) image.Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode reads a JPEG, PNG or GIF. A GIF gives its first frame. It doesn't apply the orientation a camera writes into a JPEG, so a photo straight from a camera may need a Rotate.
func Fit ¶
Fit shrinks it so that neither side is over max, keeping its shape. A picture that's already small enough comes back as it is.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.