Documentation
¶
Index ¶
- Constants
- func AddBackgroundColor(img image.Image, clr color.Color) draw.Image
- func AddBackgroundWhite(img image.Image) image.Image
- func AddBorderRGBA(img *image.RGBA, clr color.Color, width int) *image.RGBA
- func AddBorderRGBAImage(img image.Image, clr color.Color, width int) *image.RGBA
- func Aspect(width, height int) float64
- func ColsFilteredColor(img image.Image, c ...color.Color) []int
- func Crop(src image.Image, retain image.Rectangle) image.Image
- func CropX(src image.Image, width uint, align string) image.Image
- func CropY(src image.Image, height uint, align string) image.Image
- func ImageAnyToRGBA(src image.Image) *image.RGBA
- func ImageAspect(img image.Image) float64
- func ImageColors(img image.Image) [][]color.Color
- func ImageToRGBA(img image.Image) *image.RGBA
- func ImageWithSetToRGBA(src draw.Image) *image.RGBA
- func IsImageExt(imagePath string) bool
- func IsNilOrEmpty(img image.Image) bool
- func MergeHorizontalRGBA(ims ImageMetaSet) image.Image
- func MergeXSameY(images []image.Image, larger bool) image.Image
- func MergeXSameYRead(locations []string, larger bool) (image.Image, error)
- func MergeYSameX(images []image.Image, larger bool) image.Image
- func MergeYSameXRead(locations []string, larger bool) (image.Image, error)
- func NRGBAtoRGBA(imgNRGBA *image.NRGBA) *image.RGBA
- func NegativeOffset(width, height, offset uint) image.Point
- func NewRGBAColor(rect image.Rectangle, clr color.RGBA) *image.RGBA
- func NewRGBATransparent(rect image.Rectangle) *image.RGBA
- func NewRGBAWhite(rect image.Rectangle) *image.RGBA
- func Overlay(src, overlay image.Image, offset image.Point) image.Image
- func OverlayMore(src, overlay image.Image, overlayLocation string, padX, padY uint) image.Image
- func OverlayPointMin(src, overlay image.Rectangle, overlayLocation string, padX, padY uint) image.Point
- func PaintBorderRGBA(img *image.RGBA, clr color.RGBA, width uint)
- func PaintColorRGBA(img *image.RGBA, clr color.RGBA)
- func PaintColorRGBARectangle(img *image.RGBA, clr color.RGBA, rectNew image.Rectangle)
- func ParseScaler(rawInterpolation string) (draw.Scaler, error)
- func ReadImage(location string) (image.Image, string, error)
- func ReadImageDimensions(imagePath string) (int, int, error)
- func ReadImageFile(filename string) (image.Image, string, error)
- func ReadImageHttp(imageUrl string) (image.Image, string, error)
- func ReadImages(locations []string) ([]image.Image, error)
- func RectangleBorderXMax(rect image.Rectangle, pixels uint) image.Rectangle
- func RectangleBorderXMin(rect image.Rectangle, pixels uint) image.Rectangle
- func RectangleBorderYMax(rect image.Rectangle, pixels uint) image.Rectangle
- func RectangleBorderYMin(rect image.Rectangle, pixels uint) image.Rectangle
- func RectanglePixelCount(r image.Rectangle) int
- func Resize(width, height uint, src image.Image, scale draw.Scaler) image.Image
- func ResizeFileJPEG(inputFile, outputFile string, outputWidth, outputHeight uint, quality int) error
- func ResizeMax(maxWidth, maxHeight uint, src image.Image, scale draw.Scaler) image.Image
- func ResizeMaxDimension(maxSide uint, src image.Image, scale draw.Scaler) image.Image
- func ResizeMin(minWidth, minHeight uint, src image.Image, scale draw.Scaler) image.Image
- func ResizeSameX(images []image.Image, larger bool) []image.Image
- func ResizeSameY(images []image.Image, larger bool) []image.Image
- func RowsFilteredColor(img image.Image, c color.Color, cmore ...color.Color) []int
- func Scale(src image.Image, rect image.Rectangle, scale draw.Scaler) image.Image
- func ScalerBest() draw.Scaler
- func ScalerDefault() draw.Scaler
- func SliceXY(images []image.Image, maxIdx int) (minX, maxX, minY, maxY, sumX, sumY int)
- func Square(src image.Image) image.Image
- func SquareLarger(src image.Image, bgcolor color.Color) image.Image
- func WriteFileJPEG(filename string, img image.Image, quality int) error
- func WriteFilePNG(filename string, img image.Image) error
- func YCbCrToRGBA(src *image.YCbCr) *image.RGBA
- type ImageMeta
- type ImageMetaSet
- type ImageStatsMulti
- type Matrix
Constants ¶
const ( AlignTop = "top" AlignCenter = "center" AlignBottom = "bottom" AlignLeft = "left" AlignRight = "right" )
const ( LocUpper = "upper" LocMiddle = "middle" LocLower = "lower" LocLeft = "left" LocCenter = "center" LocRight = "right" LocUpperLeft = "upperleft" LocUpperRight = "upperright" LocLowerLeft = "lowerleft" LocLowerRight = "lowerright" )
const ( FileExtensionWebp = ".webp" FormatNameJPG = "jpeg" FormatNamePNG = "png" FormatNameWEBP = "webp" )
const ( JPEGQualityDefault int = 80 JPEGQualityMax int = 100 )
Variables ¶
This section is empty.
Functions ¶
func AddBackgroundColor ¶
AddBackgroundColor adds a background of `color.Color` to an image. It is is useful when the image has a transparent background. Use `colornames` for more colors, e.g. `colornames.Blue`. This returns a `draw.Image` so it can be used as an input to `draw.Draw()`.
func AddBackgroundWhite ¶
AddBackgroundWhite adds a white background which is usable when the image has a transparent background.
func AddBorderRGBA ¶ added in v0.33.2
func AddBorderRGBAImage ¶ added in v0.33.2
func ColsFilteredColor ¶ added in v0.33.3
func ImageAspect ¶
func ImageColors ¶ added in v0.33.5
ImageColors returns colors for an image covering the pixels described in `image.Rectangle`: https://pkg.go.dev/image#Rectangle
func IsImageExt ¶
func IsNilOrEmpty ¶
func MergeHorizontalRGBA ¶
func MergeHorizontalRGBA(ims ImageMetaSet) image.Image
MergeHorizontalRGBA returns an image that is composed of non-overlapping imagers in ImageMetaSet. The code here is adapted from https://stackoverflow.com/a/35965499/1908967
func NegativeOffset ¶
func OverlayMore ¶ added in v0.35.6
func OverlayPointMin ¶ added in v0.35.6
func PaintColorRGBARectangle ¶
func RectangleBorderXMax ¶
func RectangleBorderXMin ¶
func RectangleBorderYMax ¶
func RectangleBorderYMin ¶
func RectanglePixelCount ¶ added in v0.35.1
func Resize ¶
Resize scales an image to the provided size units. Use a 0 to scale the aspect ratio. See gitub.com/nfnt/resize for Lanczos3, etc. https://github.com/nfnt/resize .
func ResizeFileJPEG ¶
func ResizeMax ¶
ResizeMax resizes an image to maximum dimensions. To resize to a maximum of 800 pixels width, the following can be used: `ResizeMax(800, 0, img, nil)`.
func ResizeMaxDimension ¶
func ResizeMin ¶
ResizeMin resizes an image to minimum dimensions. To resize to a minimum of 800 pixels width, the following can be used: `ResizeMin(800, 0, img, nil)`.
func RowsFilteredColor ¶ added in v0.33.2
func Scale ¶
Scale will resize the image to the provided rectangle using the provided interpolation function.
func ScalerBest ¶
func ScalerDefault ¶
func Square ¶
Square returns an image that is cropped to where the height and weight are equal to the smaller of the source image.
func SquareLarger ¶ added in v0.35.5
SquareLarger returns an image that is cropped to where the height and weight are equal to the larger of the source image.
Types ¶
type ImageMeta ¶
func NewImageMeta ¶ added in v0.35.0
func (*ImageMeta) ColorAverage ¶ added in v0.33.2
type ImageMetaSet ¶
type ImageMetaSet struct {
ImageMetas []ImageMeta
}
func NewImageSetFiles ¶
func NewImageSetFiles(filenames []string) (ImageMetaSet, error)
func (*ImageMetaSet) CloseFilesAll ¶
func (ims *ImageMetaSet) CloseFilesAll() error
func (*ImageMetaSet) MaxX ¶
func (ims *ImageMetaSet) MaxX() int
func (*ImageMetaSet) MaxY ¶
func (ims *ImageMetaSet) MaxY() int
func (*ImageMetaSet) Stats ¶
func (ims *ImageMetaSet) Stats() ImageStatsMulti
func (*ImageMetaSet) SumX ¶
func (ims *ImageMetaSet) SumX(maxIndexInclusive int) int
func (*ImageMetaSet) SumY ¶
func (ims *ImageMetaSet) SumY(maxIndexInclusive int) int
type Matrix ¶
func MatrixRead ¶
func (Matrix) AddBackgroundColor ¶
AddBackgroundColor adds a background of `color.Color` to the images. It is is useful when the image has a transparent background. Use `colornames` for more colors, e.g. `colornames.Blue`.