image

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexToRGBA added in v0.4.0

func HexToRGBA(hexColor string) (color.RGBA, error)

Types

type Combiner

type Combiner interface {
	AdjustImageOpacity(img Image, opacity float64) Image
	CombineImages(img1, img2 Image) Image
	EncodeImage(img Image) (*bytes.Buffer, error)
	HexChromaKeySwap(img Image, chromaKey, newColor string) (Image, error)
}

type Decoder

type Decoder interface {
	Decode(r io.Reader) (Image, error)
}

type DefaultDecoder

type DefaultDecoder struct {
}

func (*DefaultDecoder) Decode

func (dd *DefaultDecoder) Decode(r io.Reader) (Image, error)

type Image

type Image = image.Image

type JPEGDecoder

type JPEGDecoder struct {
}

func (*JPEGDecoder) Decode

func (jd *JPEGDecoder) Decode(r io.Reader) (Image, error)

type PNGCombiner

type PNGCombiner struct {
	// contains filtered or unexported fields
}

func NewPNGCombiner

func NewPNGCombiner(opts ...PNGCombinerOption) *PNGCombiner

func (*PNGCombiner) AdjustImageOpacity added in v0.1.0

func (pc *PNGCombiner) AdjustImageOpacity(img Image, opacity float64) Image

Adjusts the image opacity of non-transparent pixels to the specified opacity The opacity adjustment is made using he over-composition mode of the Porter-Duff algorithm. Using over-composition since this (based on observation) allows for the best result when blending foreground over background in the current use case. The other modes can be added later and this function can be refactored if needed.

func (*PNGCombiner) CombineImages

func (pc *PNGCombiner) CombineImages(img1, img2 Image) Image

func (*PNGCombiner) EncodeImage added in v0.1.0

func (pc *PNGCombiner) EncodeImage(img Image) (*bytes.Buffer, error)

func (*PNGCombiner) HexChromaKeySwap added in v0.4.0

func (pc *PNGCombiner) HexChromaKeySwap(img Image, chromaKey, newColor string) (Image, error)

type PNGCombinerOption

type PNGCombinerOption func(p *PNGCombiner)

func WithBestPNGCompression

func WithBestPNGCompression() PNGCombinerOption

func WithBestSpeedPNGCompression

func WithBestSpeedPNGCompression() PNGCombinerOption

func WithCompressionLevel

func WithCompressionLevel(level png.CompressionLevel) PNGCombinerOption

func WithDefaultPNGCompression

func WithDefaultPNGCompression() PNGCombinerOption

func WithNoPNGCompression

func WithNoPNGCompression() PNGCombinerOption

type PNGDecoder

type PNGDecoder struct {
}

func (*PNGDecoder) Decode

func (pd *PNGDecoder) Decode(r io.Reader) (Image, error)

Jump to

Keyboard shortcuts

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