Documentation ¶
Index ¶
- Variables
- func CanOptimize(optimizers []ImageOptimizer, mimeType string, acceptedTyped []string) bool
- type AutomaticOptimizer
- type ImageDescription
- type ImageOptimizer
- type ImageQualityOptimizer
- type MozjpegOptimizer
- type Name
- type OptimizeParams
- type OptipngOptimizer
- type Task
- type TaskPool
- type WebpLosslessOptimizer
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPool = NewTaskPool()
Functions ¶
func CanOptimize ¶
func CanOptimize(optimizers []ImageOptimizer, mimeType string, acceptedTyped []string) bool
Types ¶
type AutomaticOptimizer ¶
type AutomaticOptimizer struct { Optimizer ImageQualityOptimizer MinSsim float64 }
func (*AutomaticOptimizer) CanOptimize ¶
func (o *AutomaticOptimizer) CanOptimize(mimeType string, acceptedTypes []string) bool
func (*AutomaticOptimizer) Optimize ¶
func (o *AutomaticOptimizer) Optimize(ctx context.Context, sourcePath string, hidpi bool) (*ImageDescription, error)
type ImageDescription ¶
func Optimize ¶
func Optimize(ctx context.Context, optimizers []ImageOptimizer, params OptimizeParams) (*ImageDescription, error)
type ImageOptimizer ¶
type ImageOptimizer interface { CanOptimize(mimeType string, acceptedTypes []string) bool Optimize(ctx context.Context, sourcePath string, hidpi bool) (*ImageDescription, error) }
func NewMozjpegLossyOptimizer ¶
func NewMozjpegLossyOptimizer(minSsim float64) ImageOptimizer
func NewMozjpegPngLossyOptimizer ¶
func NewMozjpegPngLossyOptimizer(minSsim float64) ImageOptimizer
func NewWebpLossyJpegOptimizer ¶
func NewWebpLossyJpegOptimizer(minSsim float64) ImageOptimizer
func NewWebpLossyPngOptimizer ¶
func NewWebpLossyPngOptimizer(minSsim float64) ImageOptimizer
type ImageQualityOptimizer ¶
type ImageQualityOptimizer interface { OptimizePrecheck(ctx context.Context, sourcePath string) (bool, error) OptimizeQuality(ctx context.Context, sourcePath string, quality int) (*ImageDescription, error) CompareImages(ctx context.Context, sourcePath string, imageDesc *ImageDescription, hidpi bool) (float64, error) ImageOptimizer }
type MozjpegOptimizer ¶
type MozjpegOptimizer struct {
Args []string
}
func (*MozjpegOptimizer) CanOptimize ¶
func (o *MozjpegOptimizer) CanOptimize(mimeType string, acceptedTypes []string) bool
func (*MozjpegOptimizer) Optimize ¶
func (o *MozjpegOptimizer) Optimize(ctx context.Context, sourcePath string, hidpi bool) (*ImageDescription, error)
type OptimizeParams ¶
type OptipngOptimizer ¶
type OptipngOptimizer struct {
Args []string
}
func (*OptipngOptimizer) CanOptimize ¶
func (o *OptipngOptimizer) CanOptimize(mimeType string, acceptedTypes []string) bool
func (*OptipngOptimizer) Optimize ¶
func (o *OptipngOptimizer) Optimize(ctx context.Context, sourcePath string, hidpi bool) (*ImageDescription, error)
type Task ¶
type Task struct { OriginalImage *ImageDescription Optimizers []ImageOptimizer Hidpi bool }
type TaskPool ¶
type TaskPool struct {
ScoringFunc func([]*ImageDescription, []error) (*ImageDescription, error)
}
func NewTaskPool ¶
func NewTaskPool() *TaskPool
type WebpLosslessOptimizer ¶
type WebpLosslessOptimizer struct {
Args []string
}
func (*WebpLosslessOptimizer) CanOptimize ¶
func (o *WebpLosslessOptimizer) CanOptimize(mimeType string, acceptedTypes []string) bool
func (*WebpLosslessOptimizer) Optimize ¶
func (o *WebpLosslessOptimizer) Optimize(ctx context.Context, sourcePath string, hidpi bool) (*ImageDescription, error)
Click to show internal directories.
Click to hide internal directories.