lib

package
v0.0.0-...-25323b0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2013 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

avatar/lib is a simple library you can use to make images squared and of fixed size.

Index

Constants

View Source
const (
	ErrSize = "Minimun size not reached. Should be at least %vx%v, is %vx%v"
)

Variables

View Source
var (
	MinSize int
)

Functions

func Crop

func Crop(m image.Image, r image.Rectangle, w, h int) image.Image

func Resample

func Resample(m image.Image, r image.Rectangle, w, h int) image.Image

Resample returns a resampled copy of the image slice r of m. The returned image has width w and height h.

func Resize

func Resize(m image.Image, r image.Rectangle, w, h int) image.Image

Resize returns a scaled copy of the image slice r of m. The returned image has width w and height h.

Types

type ImageValidation

type ImageValidation struct {
	Condition func(int, int) bool
	F         func(*ProfileImage) (*image.Image, error)
	Id        func() string
}

func (*ImageValidation) Validate

func (iv *ImageValidation) Validate(pi *ProfileImage) error

type ProfileImage

type ProfileImage struct {
	Width,
	Height int

	ErrorMsg string
	// contains filtered or unexported fields
}

func MakeProfileImage

func MakeProfileImage(im image.Image, minSize int) (*ProfileImage, error)

func NewProfileImage

func NewProfileImage(im image.Image) *ProfileImage

func (*ProfileImage) NewImage

func (pi *ProfileImage) NewImage(im image.Image)

func (*ProfileImage) Save

func (pi *ProfileImage) Save(w io.Writer) error

Jump to

Keyboard shortcuts

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