imgutil

package module
v0.0.0-...-8a3be14 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PNGEncoder = &png.Encoder{

	CompressionLevel: png.NoCompression,
}

Functions

func MaxSize

func MaxSize(w, h, maxW, maxH int) (int, int)

MaxSize returns the maximum size that can fit within the given max width and height. Aspect ratio is preserved.

func Process

func Process(src io.Reader, processors []Processor) (image.Image, error)

Process takes a processor and run them through the image decoded from the stream. The returned image is the processed image.

func ProcessAnimation

func ProcessAnimation(src io.Reader, processors []Processor) (*gif.GIF, error)

ProcessAnimation works similarly to Process, but parses a GIF.

func ProcessAnimationStream

func ProcessAnimationStream(dst io.Writer, src io.Reader, processors []Processor) error

ProcessAnimationStream works similarly to ProcessStream, but parses a GIF.

func ProcessStream

func ProcessStream(dst io.Writer, src io.Reader, processors []Processor) error

ProcessStream takes a processor and run them through the image decoded from the stream. The returned bytes are PNG-encoded and uncompressed.

Types

type Processor

type Processor func(image.Image) *image.NRGBA

func Prepend

func Prepend(p1 Processor, pN []Processor) []Processor

Prepend prepends p1 before pN.

func Resize

func Resize(maxW, maxH int) Processor

Resize uses MaxSize to calculate and resize the image accordingly.

func Round

func Round(antialias bool) Processor

Round renders an anti-aliased round image. This image crops the source and makes it a square.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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