Documentation
¶
Overview ¶
Package picture makes the pictures the server derives from an image: the thumbnails, a HEIF photo's viewing copy, avatars and emoji. Scaling is bild's Catmull-Rom resampler; turning a picture upright per its EXIF orientation is a plain remapping of its pixels.
Every picture comes back as *image.NRGBA, colour not premultiplied by alpha: that is how the WebP encoder reads pixels (it takes an *image.RGBA's bytes as they are, which would darken every partly transparent pixel).
Index ¶
- func Fill(img image.Image, w, h int) *image.NRGBA
- func Fit(img image.Image, w, h int) *image.NRGBA
- func JPEGOrientation(header []byte) int
- func RGBA(img image.Image) *image.RGBA
- func ShownSize(w, h, orientation int) (int, int)
- func Shrink(img image.Image, orientation, w, h int) *image.NRGBA
- func Upright(img *image.NRGBA, orientation int) *image.NRGBA
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fit ¶
Fit scales img down to fit within w×h, keeping its shape. An image that fits already keeps its size: it is never enlarged.
func JPEGOrientation ¶
JPEGOrientation is the EXIF orientation (1–8) in a JPEG's header, or 0 when it has none (or is no JPEG). An unreadable one is none: the image is then shown as stored.
func RGBA ¶
RGBA is img as the resizer reads it: img itself when it already is an *image.RGBA, otherwise a copy, 4 bytes a pixel. Convert once when several pictures are made from one image.
func ShownSize ¶
ShownSize is the size of w×h stored pixels as shown: orientations 5–8 turn them a quarter.
Types ¶
This section is empty.