processor

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	Compress(input image.Image, quality int) (image.Image, error)
	Resize(input image.Image, width int, height int) (image.Image, error)
	WaterMark(input image.Image, texture image.Image, x int, y int) (image.Image, error)
}

Engine is the interface of Processor

func NewProcessor

func NewProcessor(format string) Engine

NewProcessor return the Processor instance

type JPEGProcessor

type JPEGProcessor struct {
	Processor
}

JPEGProcessor is the processor for JPEG images

func (*JPEGProcessor) Compress

func (p *JPEGProcessor) Compress(input image.Image, quality int) (image.Image, error)

Compress the images

func (*JPEGProcessor) Resize

func (p *JPEGProcessor) Resize(input image.Image, width int, height int) (image.Image, error)

Resize the images

func (*JPEGProcessor) WaterMark added in v0.2.0

func (p *JPEGProcessor) WaterMark(input image.Image, texture image.Image, x int, y int) (image.Image, error)

WaterMark the images

type PNGProcessor

type PNGProcessor struct {
	Processor
}

PNGProcessor is the processor for PNG images

func (*PNGProcessor) Compress

func (p *PNGProcessor) Compress(input image.Image, quality int) (image.Image, error)

Compress the images

func (*PNGProcessor) Resize

func (p *PNGProcessor) Resize(input image.Image, width int, height int) (image.Image, error)

Resize the images

func (*PNGProcessor) WaterMark added in v0.2.0

func (p *PNGProcessor) WaterMark(input image.Image, texture image.Image, x int, y int) (image.Image, error)

WaterMark the images

type Processor

type Processor struct {
	Engine
	Format string
}

Processor is the abstract struct of processor

Jump to

Keyboard shortcuts

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