image

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Quality

func Quality(img image.Image, imagetype string, quality int) (_r []byte, err error)

func QualityByBinary

func QualityByBinary(srcData []byte, quality int) (_r []byte, err error)

Types

type Image

type Image struct {
	ResizeFilter ResampleFilter
}

func (*Image) Encode

func (t *Image) Encode(srcData []byte, width, height int, mode Mode, options *Options) (destData []byte, err error)

func (*Image) Resize

func (t *Image) Resize(srcData []byte, width, height int, mode Mode) (destData []byte, err error)

type Mode

type Mode int8
const (
	Mode0 Mode = iota
	Mode1
	Mode2
	Mode3
	Mode4
	Mode5
)

type Options

type Options struct {
	Gray       bool
	Invert     bool
	Format     string
	Rotate     int
	FlipH      bool
	FlipV      bool
	Colors     int
	Quality    int
	CropAnchor []int
	CropSide   []int
	Blur       float64
	ScaleUpper []int //Scale to maximum mode
	ScaleLower []int //Scale to minimal mode
}

type ResampleFilter

type ResampleFilter int
const (
	// NearestNeighbor is a nearest-neighbor filter (no anti-aliasing).
	NearestNeighbor ResampleFilter = iota

	// Box filter (averaging pixels).
	Box

	// Linear filter.
	Linear

	// Hermite cubic spline filter (BC-spline; B=0; C=0).
	Hermite

	// MitchellNetravali is Mitchell-Netravali cubic filter (BC-spline; B=1/3; C=1/3).
	MitchellNetravali

	// CatmullRom is a Catmull-Rom - sharp cubic filter (BC-spline; B=0; C=0.5).
	CatmullRom

	// BSpline is a smooth cubic filter (BC-spline; B=1; C=0).
	BSpline

	// Gaussian is a Gaussian blurring filter.
	Gaussian

	// Bartlett is a Bartlett-windowed sinc filter (3 lobes).
	Bartlett

	// Lanczos filter (3 lobes).
	Lanczos

	// Hann is a Hann-windowed sinc filter (3 lobes).
	Hann

	// Hamming is a Hamming-windowed sinc filter (3 lobes).
	Hamming

	// Blackman is a Blackman-windowed sinc filter (3 lobes).
	Blackman

	// Welch is a Welch-windowed sinc filter (parabolic window, 3 lobes).
	Welch

	// Cosine is a Cosine-windowed sinc filter (3 lobes).
	Cosine
)

type ResizeType

type ResizeType int
const (
	SCALE ResizeType = iota
	THUMBNAIL
)

Jump to

Keyboard shortcuts

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