asset

package
v0.0.0-...-d11079c Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IMAGE                  = "image"
	JPEG                   = "image/jpeg"
	PNG                    = "image/png"
	WEBP                   = "image/webp"
	DefaultImageType       = vips.ImageTypeJPEG
	DefaultInterestingType = vips.InterestingNone
)

Variables

View Source
var ImageTypes = invertImageTypes()
View Source
var InterestingTypesToString = map[vips.Interesting]string{
	vips.InterestingNone:      "none",
	vips.InterestingCentre:    "centre",
	vips.InterestingEntropy:   "entropy",
	vips.InterestingAttention: "attention",
	vips.InterestingLow:       "low",
	vips.InterestingHigh:      "high",
	vips.InterestingAll:       "all",
}
View Source
var StringToInterestingTypes = map[string]vips.Interesting{
	"none":      vips.InterestingNone,
	"centre":    vips.InterestingCentre,
	"entropy":   vips.InterestingEntropy,
	"attention": vips.InterestingAttention,
	"low":       vips.InterestingLow,
	"high":      vips.InterestingHigh,
	"all":       vips.InterestingAll,
}

Functions

This section is empty.

Types

type Asset

type Asset struct {
	File        *os.File
	ContentType string
	// Preferred extension for files that have more than one
	Ext        string
	Extensions []string
	Name       string
	PathPrefix string
	Path       string
	Sha256     string
	Type       string
	// contains filtered or unexported fields
}

func New

func New(r io.Reader) (*Asset, error)

func (*Asset) Resize

func (a *Asset) Resize(rp *ResizeParams) ([]byte, error)

type ResizeParams

type ResizeParams struct {
	Width       int
	Height      int
	Quality     int
	ImageType   vips.ImageType
	Interesting vips.Interesting
}

func NewResizeParams

func NewResizeParams() *ResizeParams

Jump to

Keyboard shortcuts

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