image

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MediaTypeJpeg is the mime type for jpeg images
	MediaTypeJpeg = "image/jpeg"
	// MediaTypePng is the mime type for png images
	MediaTypePng = "image/png"
	// MediaTypeGif is the mime type for gif images
	MediaTypeGif = "image/gif"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image interface {
	goimg.Image
	Duplicate() Image
	Size() Size
	Draw(img Image, x, y int, over bool)
	Resize(width, height int)
	ResizeFit(width, height int)
	ResizeLimit(width, height int)
	Crop(x, y, w, h int)
	ResizeFill(width, height int)
	ToJpeg(quality int) (*bytes.Buffer, error)
	ToPng(level PngCompressionOpt) (*bytes.Buffer, error)
	ToBase64(quality int) (string, error)
}

Image is an open image file

func FromGif

func FromGif(file io.Reader) (Image, error)

func FromImage

func FromImage(img goimg.Image) Image

func FromJpeg

func FromJpeg(file io.Reader) (Image, error)

func FromPng

func FromPng(file io.Reader) (Image, error)

func LoadImage

func LoadImage(c echo.Context, formField string) (Image, error)

type Options

type Options struct {
	Width        int
	Height       int
	ThumbWidth   int
	ThumbHeight  int
	Quality      int
	ThumbQuality int
	Fill         bool
}

Options represent the image options of the loaded image

type PngCompressionOpt

type PngCompressionOpt int
const (
	PngDefault PngCompressionOpt = iota
	PngNone
	PngFast
	PngBest
)

type Size

type Size struct {
	W, H int
}

Jump to

Keyboard shortcuts

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