imagedit

package
v0.0.0-...-1ad4281 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadType   = errors.New("imagedit: Error bad file type")
	ErrNilOutput = errors.New("imagedit: Error nil output")
)

Functions

func HashEncode

func HashEncode(bytes []byte) string

Types

type AspectRatio

type AspectRatio int
const (
	// Use Image AspectRatio
	AR_Image AspectRatio = iota
	// 1:1 square
	AR_1x1
	// 5:4
	AR_5x4
	// 4:3
	AR_4x3
	// 3:2
	AR_3x2
	// 16:10
	AR_16x10
	// 16:9
	AR_16x9
	// 3:1
	AR_3x1
)

type Image

type Image struct {
	// contains filtered or unexported fields
}

func MPHtoImg

func MPHtoImg(fileHead *multipart.FileHeader) (img *Image, b58hash string, err error)

func NewFromBlob

func NewFromBlob(blob []byte) (*Image, error)

func NewFromPath

func NewFromPath(imagePath string) (*Image, error)

func (*Image) AR

func (img *Image) AR(ar AspectRatio) (width, height int)

func (*Image) ARMaxSize

func (img *Image) ARMaxSize(ar AspectRatio, maxPx int) (width, height int)

func (*Image) BlobToImg

func (img *Image) BlobToImg(blob []byte) (err error)

Decodes blob &

func (*Image) Close

func (img *Image) Close()

func (*Image) Crop

func (img *Image) Crop(width, height int) error

Crop image

func (*Image) CropAR

func (img *Image) CropAR(ar AspectRatio) error

CropAR crops image using aspect ratio

func (*Image) Export

func (img *Image) Export() ([]byte, error)

func (*Image) Fix

func (img *Image) Fix()

func (*Image) GetFormat

func (img *Image) GetFormat() fileutil.Format

func (*Image) Pages

func (img *Image) Pages() (pages int)

Pages returns number of pages

func (*Image) Resize

func (img *Image) Resize(width, height int) error

Resize image

func (*Image) Thumbnail

func (img *Image) Thumbnail(width, height int) error

Thumbnail resizes and crops image

func (*Image) ThumbnailAR

func (img *Image) ThumbnailAR(ar AspectRatio) error

ThumbnailAR resizes and crops image using aspect ratio

func (*Image) WH

func (img *Image) WH() (width, height int)

WH returns image width & height

return width, height int, err error

func (*Image) WriteToPath

func (img *Image) WriteToPath(imagePath string) error

type ImageOptions

type ImageOptions struct {
	FileType fileutil.Format
}

Jump to

Keyboard shortcuts

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