Documentation ¶
Index ¶
- func IsAnimationSupported(imageType vips.ImageType) bool
- func WrapErr(err error) error
- type FallbackFunc
- type FilterFunc
- type FilterMap
- type Metadata
- type Option
- func WithAvifSpeed(avifSpeed int) Option
- func WithConcurrency(num int) Option
- func WithDebug(debug bool) Option
- func WithDisableBlur(disabled bool) Option
- func WithDisableFilters(filters ...string) Option
- func WithFilter(name string, filter FilterFunc) Option
- func WithForceBmpFallback() Option
- func WithLogger(logger *zap.Logger) Option
- func WithMaxAnimationFrames(num int) Option
- func WithMaxCacheFiles(num int) Option
- func WithMaxCacheMem(num int) Option
- func WithMaxCacheSize(num int) Option
- func WithMaxFilterOps(num int) Option
- func WithMaxHeight(height int) Option
- func WithMaxResolution(res int) Option
- func WithMaxWidth(width int) Option
- func WithMozJPEG(enabled bool) Option
- func WithStripMetadata(enabled bool) Option
- func WithUnlimited(unlimited bool) Option
- type Processor
- func (v *Processor) CheckResolution(img *vips.Image, err error) (*vips.Image, error)
- func (v *Processor) FocalThumbnail(img *vips.Image, w, h int, fx, fy float64) (err error)
- func (v *Processor) NewImage(ctx context.Context, blob *imagor.Blob, n, page int, dpi int) (*vips.Image, error)
- func (v *Processor) NewThumbnail(ctx context.Context, blob *imagor.Blob, width, height int, ...) (*vips.Image, error)
- func (v *Processor) Process(ctx context.Context, blob *imagor.Blob, p imagorpath.Params, ...) (*imagor.Blob, error)
- func (v *Processor) Shutdown(_ context.Context) error
- func (v *Processor) Startup(_ context.Context) error
- func (v *Processor) Thumbnail(img *vips.Image, width, height int, crop vips.Interesting, size vips.Size) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAnimationSupported ¶ added in v1.5.0
IsAnimationSupported indicates if image type supports animation
Types ¶
type FallbackFunc ¶ added in v1.5.5
FallbackFunc vips.Image fallback handler when vips.NewImageFromSource failed
type FilterFunc ¶
type FilterFunc func(ctx context.Context, img *vips.Image, load imagor.LoadFunc, args ...string) (err error)
FilterFunc filter handler function
type Metadata ¶ added in v1.5.0
type Metadata struct { Format string `json:"format"` ContentType string `json:"content_type"` Width int `json:"width"` Height int `json:"height"` Orientation int `json:"orientation"` Pages int `json:"pages"` Bands int `json:"bands"` Exif map[string]string `json:"exif"` }
Metadata image attributes
type Option ¶
type Option func(v *Processor)
Option Processor option
func WithAvifSpeed ¶ added in v1.5.0
WithAvifSpeed with avif speed option
func WithConcurrency ¶ added in v0.2.11
WithConcurrency with libvips concurrency option
func WithDisableBlur ¶
WithDisableBlur with disable blur option
func WithDisableFilters ¶
WithDisableFilters with disable filters option
func WithFilter ¶
func WithFilter(name string, filter FilterFunc) Option
WithFilter with filer option of name and FilterFunc pair
func WithForceBmpFallback ¶ added in v1.5.5
func WithForceBmpFallback() Option
WithForceBmpFallback force with BMP fallback
func WithMaxAnimationFrames ¶ added in v0.8.0
WithMaxAnimationFrames with maximum count of animation frames option
func WithMaxCacheFiles ¶ added in v0.2.9
WithMaxCacheFiles with libvips max cache files option
func WithMaxCacheMem ¶ added in v0.2.9
WithMaxCacheMem with libvips max cache mem option
func WithMaxCacheSize ¶ added in v0.2.9
WithMaxCacheSize with libvips max cache size option
func WithMaxFilterOps ¶
WithMaxFilterOps with maximum number of filter operations option
func WithMaxHeight ¶ added in v0.5.0
WithMaxHeight with maximum height option
func WithMaxResolution ¶ added in v0.9.12
WithMaxResolution with maximum resolution option
func WithMaxWidth ¶ added in v0.5.0
WithMaxWidth with maximum width option
func WithMozJPEG ¶ added in v0.8.7
WithMozJPEG with MozJPEG option. Require MozJPEG to be installed
func WithStripMetadata ¶ added in v1.5.0
WithStripMetadata with strip all metadata from image option
func WithUnlimited ¶ added in v1.5.5
WithUnlimited with unlimited option that remove all denial of service limits
type Processor ¶ added in v1.5.0
type Processor struct { Filters FilterMap FallbackFunc FallbackFunc DisableBlur bool DisableFilters []string MaxFilterOps int Logger *zap.Logger Concurrency int MaxCacheFiles int MaxCacheMem int MaxCacheSize int MaxWidth int MaxHeight int MaxResolution int MaxAnimationFrames int MozJPEG bool StripMetadata bool AvifSpeed int Unlimited bool Debug bool // contains filtered or unexported fields }
Processor implements imagor.Processor interface
func NewProcessor ¶ added in v1.5.0
NewProcessor create Processor
func (*Processor) CheckResolution ¶ added in v1.5.0
CheckResolution check image resolution for image bomb prevention
func (*Processor) FocalThumbnail ¶ added in v1.5.0
FocalThumbnail handles thumbnail with custom focal point
func (*Processor) NewImage ¶ added in v1.5.0
func (v *Processor) NewImage(ctx context.Context, blob *imagor.Blob, n, page int, dpi int) (*vips.Image, error)
NewImage creates new Image from imagor.Blob
func (*Processor) NewThumbnail ¶ added in v1.5.0
func (v *Processor) NewThumbnail( ctx context.Context, blob *imagor.Blob, width, height int, crop vips.Interesting, size vips.Size, n, page int, dpi int, ) (*vips.Image, error)
NewThumbnail creates new thumbnail with resize and crop from imagor.Blob
func (*Processor) Process ¶ added in v1.5.0
func (v *Processor) Process( ctx context.Context, blob *imagor.Blob, p imagorpath.Params, load imagor.LoadFunc, ) (*imagor.Blob, error)
Process implements imagor.Processor interface