Documentation
¶
Overview ¶
Package artwork downscales and encodes images which represent documents, such as the scans of their pages, their thumbnails, and their covers
Index ¶
- func Downscale(img image.Image, size int) image.Image
- func Encode(img image.Image) []byte
- func Image(data []byte, key string, o *metadata.Opts) metadata.Metadata
- func Orient(img image.Image, orientation int) image.Image
- func OrientedImage(data []byte, key string, orientation int, o *metadata.Opts) metadata.Metadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Downscale ¶
Downscale returns the image scaled down so its width and height are at most size, keeping its aspect ratio, or the image itself when it's smaller
func Encode ¶
Encode returns the image encoded as a greyscale PNG image when it's grey, such as a scan of a black and white document, which is smaller and sharper than a JPEG image, or else as a JPEG image
func Image ¶
Image returns the encoded image as artwork, with the key, downscaled to fit the largest image dimension when it's larger, or re-encoded when it's in a format which isn't displayed on the web, such as BMP or TIFF, or it has an orientation in its EXIF data which isn't as it is, as its EXIF data isn't kept, and otherwise as it is, or nil when it can't be decoded (see OrientedImage).
func Orient ¶
Orient returns the image transformed to be displayed, by its orientation, from 1 to 8, as EXIF defines it: 1 is as it is, 2 is flipped horizontally, 3 is rotated 180°, 4 is flipped vertically, 5 is transposed, 6 is rotated 90° clockwise, 7 is transverse, and 8 is rotated 90° anticlockwise. It returns the image itself for 1, or an orientation which isn't valid. A grey image stays grey, and any other is RGBA.
func OrientedImage ¶
OrientedImage returns the encoded image as artwork, with the key, as Image does, transformed by the orientation, from 1 to 8, as EXIF defines it (see Orient), such as the orientation of a photo for its thumbnail, which has no EXIF data of its own. An image in a lossless format, such as PNG, is re-encoded as a PNG image, a JPEG image as a JPEG image, and any other as a greyscale PNG image when it's grey, or else a JPEG image.
Types ¶
This section is empty.