Documentation ¶
Index ¶
- Variables
- func CapImageSize(img image.Image, maxSize int) *image.RGBA
- func Draw(src image.Image, dst *image.RGBA, quality bool)
- func FlushImage(tar io.Writer, img image.Image, quality int) error
- func GeneratePhash(img image.Image, scale int) []byte
- func ImageFromReader(r io.Reader) (img image.Image, err error)
- func Is(kinds ...Kind) func(key string) bool
- func MinImageSize(img image.Image, maxSize int) *image.RGBA
- func ReduceImageSize(img image.Image, maxDimension int) *image.RGBA
- func RegisterMasks(mask Kind, keys ...string)
- func ResizeImage(img image.Image, width, height int) *image.RGBA
- type Kind
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoMIME = errors.New("no mime could be detected") ErrUnsupportedMIME = errors.New("detected mime is unsupported") ErrFFMPEGNotFound = errors.New("ffmpeg not found in PATH") )
View Source
var CntMasks = map[Kind][]string{ IMAGE: {".jpg", ".jpeg", ".png", ".apng", ".gif", ".bmp", ".webp", ".avif", ".jxl", ".tiff"}, VIDEO: {".mp4", ".m4v", ".webm", ".mkv", ".avi", ".mov", ".mpg", ".mpeg"}, AUDIO: {".m4a", ".opus", ".ogg", ".mp3", ".flac", ".wav", ".aac"}, }
View Source
var ExtToMaskMap = map[string]Kind{}
Functions ¶
func CapImageSize ¶ added in v0.0.7
CapImageSize creates an empty RGBA image with the same aspect ration as the input, but capped to the maxSize provided, such that neither height nor width are above that value.
edge cases:
- source file very tall, very wide, resulting in an unusable image or a very large filesize
func Draw ¶ added in v0.0.7
Draw copies src to dst, using either a fast algorithm, or a quality algorithm.
func FlushImage ¶ added in v0.0.7
func GeneratePhash ¶
GeneratePhash returns a basic perceptual hash of the given image.
func ImageFromReader ¶ added in v0.0.4
func MinImageSize ¶ added in v0.0.8
MinImageSize cap the smaller dimension to maxSize while maintaining aspect ration.
func ReduceImageSize ¶ added in v0.0.4
func RegisterMasks ¶ added in v0.0.7
Types ¶
Click to show internal directories.
Click to hide internal directories.