imageutil

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultQualityJPEG int = 80

Variables

This section is empty.

Functions

func AddBackgroundWhite

func AddBackgroundWhite(imgSrc image.Image) image.Image

AddBackgroundWhite adds a white background which is usable when the image has a transparent background.

func Aspect

func Aspect(width, height int) float64

func BestScaler

func BestScaler() draw.Scaler

func ImageAspect

func ImageAspect(img image.Image) float64

func ImageWidthHeight

func ImageWidthHeight(img image.Image) (int, int)

func IsImageExt

func IsImageExt(imagePath string) bool

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 OverlayCenterYLeftAlign

func OverlayCenterYLeftAlign(imgBg, imgOver image.Image) image.Image

func ParseScalar

func ParseScalar(rawInterpolation string) (draw.Scaler, error)

func ReadImage

func ReadImage(filename string) (image.Image, error)

func ReadImageDimensions

func ReadImageDimensions(imagePath string) (int, int, error)

func Resize

func Resize(width, height uint, src image.Image, scale draw.Scaler) image.Image

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 Scale

func Scale(src image.Image, rect image.Rectangle, scale draw.Scaler) image.Image

Scale will resize the image to the provided rectangle using the provided interpolation function.

func WriteFileJPEG

func WriteFileJPEG(filename string, img image.Image, quality int) error

func WriteFilePNG

func WriteFilePNG(filename string, img image.Image) error

Types

type ImageMeta

type ImageMeta struct {
	File       *os.File
	FormatName string
	Image      image.Image
}

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 ImageStatsMulti

type ImageStatsMulti struct {
	MaxX int
	SumX int
	MaxY int
	SumY int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL