Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoopResizeResult = ResizeResult{
Scale: 1.0,
}
Functions ¶
func LibvipsInit ¶
func LibvipsInit()
LibvipsInit calls vips_init, and then vips_cache_set_max, etc to make libvips available for use. The counterpart LibvipsShutdown is intentionally not exposed because libvips does not support restart. After vips_shutdown has been called, libvips can no longer be used again in the program.
Types ¶
type ImageDimensions ¶
type ImageDimensions struct { // Width is the width of the source image. Width int // Height is the height of the source image. Height int }
ImageDimensions is the dimensions of the source image.
type Options ¶
type Options struct { Width int Height int ResizingModeType ResizingModeType }
func (Options) ShouldResize ¶
type ResizeDimensions ¶
type ResizeDimensions struct { // Width is the maximum width of the resulting image. Width int // Height is the maximum height of the resulting image. Height int }
ResizeDimensions is the input parameters of the resize operation.
type ResizeResult ¶
type ResizeResult struct { // Scale is the scale of the resulting image. // If it is 1, then scaling is not performed. Scale float64 // Crop is necessary sometimes if the aspect ratios do not match. Crop *image.Rectangle }
ResizeResult is the result of the resize operation.
type ResizingMode ¶
type ResizingMode interface {
Resize(image ImageDimensions, resize ResizeDimensions) ResizeResult
}
ResizingMode is the abstraction of different resizing flavors.
func ResizingModeFromType ¶
func ResizingModeFromType(t ResizingModeType) ResizingMode
type ResizingModeContain ¶
type ResizingModeContain struct{}
func (ResizingModeContain) Resize ¶
func (ResizingModeContain) Resize(image ImageDimensions, resize ResizeDimensions) ResizeResult
type ResizingModeCover ¶
type ResizingModeCover struct{}
func (ResizingModeCover) Resize ¶
func (ResizingModeCover) Resize(img ImageDimensions, resize ResizeDimensions) ResizeResult
type ResizingModeScaleDown ¶
type ResizingModeScaleDown struct{}
ResizingModeScaleDown shrink the image so that the resulting image is fully fit within ResizeDimensions.
func (ResizingModeScaleDown) Resize ¶
func (ResizingModeScaleDown) Resize(image ImageDimensions, resize ResizeDimensions) ResizeResult
type ResizingModeType ¶
type ResizingModeType string
const ( ResizingModeTypeScaleDown ResizingModeType = "scale-down" ResizingModeTypeContain ResizingModeType = "contain" ResizingModeTypeCover ResizingModeType = "cover" )
Click to show internal directories.
Click to hide internal directories.