Documentation ¶
Index ¶
- Constants
- Variables
- func ColourspaceIsSupported(buf []byte) (bool, error)
- func DetermineImageTypeName(buf []byte) string
- func ImageTypeName(t ImageType) string
- func Initialize()
- func IsTypeNameSupported(t string) bool
- func IsTypeSupported(t ImageType) bool
- func Read(path string) ([]byte, error)
- func Resize(buf []byte, o Options) ([]byte, error)
- func Shutdown()
- func VipsDebugInfo()
- func Write(path string, buf []byte) error
- type Angle
- type Color
- type Direction
- type GaussianBlur
- type Gravity
- type Image
- func (i *Image) Colourspace(c Interpretation) ([]byte, error)
- func (i *Image) ColourspaceIsSupported() (bool, error)
- func (i *Image) Convert(t ImageType) ([]byte, error)
- func (i *Image) Crop(width, height int, gravity Gravity) ([]byte, error)
- func (i *Image) CropByHeight(height int) ([]byte, error)
- func (i *Image) CropByWidth(width int) ([]byte, error)
- func (i *Image) Enlarge(width, height int) ([]byte, error)
- func (i *Image) EnlargeAndCrop(width, height int) ([]byte, error)
- func (i *Image) Extract(top, left, width, height int) ([]byte, error)
- func (i *Image) Flip() ([]byte, error)
- func (i *Image) Flop() ([]byte, error)
- func (i *Image) ForceResize(width, height int) ([]byte, error)
- func (i *Image) Image() []byte
- func (i *Image) Interpretation() (Interpretation, error)
- func (i *Image) Metadata() (ImageMetadata, error)
- func (i *Image) Process(o Options) ([]byte, error)
- func (i *Image) Resize(width, height int) ([]byte, error)
- func (i *Image) ResizeAndCrop(width, height int) ([]byte, error)
- func (i *Image) Rotate(a Angle) ([]byte, error)
- func (i *Image) Size() (ImageSize, error)
- func (i *Image) Thumbnail(pixels int) ([]byte, error)
- func (i *Image) Type() string
- func (i *Image) Watermark(w Watermark) ([]byte, error)
- func (i *Image) Zoom(factor int) ([]byte, error)
- type ImageMetadata
- type ImageSize
- type ImageType
- type Interpolator
- type Interpretation
- type Options
- type Sharpen
- type VipsMemoryInfo
- type Watermark
Constants ¶
const ( QUALITY = 80 MAX_SIZE = 16383 )
const HasMagickSupport = int(C.VIPS_MAGICK_SUPPORT) == 1
const Version = "0.1.24"
const VipsVersion = string(C.VIPS_VERSION)
Current libvips version
const WATERMARK_FONT = "sans 10"
Variables ¶
var ColorBlack = Color{0, 0, 0}
Shortcut to black RGB color representation
var ImageTypes = map[ImageType]string{ JPEG: "jpeg", PNG: "png", WEBP: "webp", TIFF: "tiff", MAGICK: "magick", }
Pairs of image type and its name
Functions ¶
func ColourspaceIsSupported ¶
Check in the image colourspace is supported by libvips
func DetermineImageTypeName ¶
Determines the image type format by name (jpeg, png, webp or tiff)
func ImageTypeName ¶
func Initialize ¶
func Initialize()
Explicit thread-safe start of libvips. Only call this function if you previously shutdown libvips
func IsTypeNameSupported ¶
Check if a given image type name is supported
func IsTypeSupported ¶
Check if a given image type is supported
func Shutdown ¶
func Shutdown()
Thread-safe function to shutdown libvips. You can call this to drop caches as well. If libvips was already initialized, the function is no-op
func VipsDebugInfo ¶
func VipsDebugInfo()
Output to stdout vips collected data. Useful for debugging
Types ¶
type Direction ¶
type Direction int
const ( HORIZONTAL Direction = C.VIPS_DIRECTION_HORIZONTAL VERTICAL Direction = C.VIPS_DIRECTION_VERTICAL )
type GaussianBlur ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image encapsulates the whole image buffer
func (*Image) Colourspace ¶
func (i *Image) Colourspace(c Interpretation) ([]byte, error)
Colour space conversion
func (*Image) ColourspaceIsSupported ¶
Check if the current image has a valid colourspace
func (*Image) CropByHeight ¶
Crop an image by height (auto width)
func (*Image) CropByWidth ¶
Crop an image by width (auto height)
func (*Image) EnlargeAndCrop ¶
Enlarge the image by width and height with additional crop transformation
func (*Image) ForceResize ¶
Force resize with custom size (aspect ratio won't be maintained)
func (*Image) Interpretation ¶
func (i *Image) Interpretation() (Interpretation, error)
Get the image interpretation type See: http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/VipsImage.html#VipsInterpretation
func (*Image) Metadata ¶
func (i *Image) Metadata() (ImageMetadata, error)
Get image metadata (size, alpha channel, profile, EXIF rotation)
func (*Image) ResizeAndCrop ¶
Resize the image to fixed width and height with additional crop transformation
type ImageMetadata ¶
type ImageMetadata struct { Orientation int Channels int Alpha bool Profile bool Type string Space string Colourspace string Size ImageSize }
ImageMedatada represents the basic metadata fields
func Metadata ¶
func Metadata(buf []byte) (ImageMetadata, error)
Extract the image metadata (size, type, alpha channel, profile, EXIF orientation...)
type ImageType ¶
type ImageType int
func DetermineImageType ¶
Determines the image type format (jpeg, png, webp or tiff)
type Interpolator ¶
type Interpolator int
const ( BICUBIC Interpolator = iota BILINEAR NOHALO )
func (Interpolator) String ¶
func (i Interpolator) String() string
type Interpretation ¶
type Interpretation int
Image interpretation type See: http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/VipsImage.html#VipsInterpretation
const ( INTERPRETATION_ERROR Interpretation = C.VIPS_INTERPRETATION_ERROR INTERPRETATION_MULTIBAND Interpretation = C.VIPS_INTERPRETATION_MULTIBAND INTERPRETATION_B_W Interpretation = C.VIPS_INTERPRETATION_B_W INTERPRETATION_CMYK Interpretation = C.VIPS_INTERPRETATION_CMYK INTERPRETATION_RGB Interpretation = C.VIPS_INTERPRETATION_RGB INTERPRETATION_sRGB Interpretation = C.VIPS_INTERPRETATION_sRGB INTERPRETATION_RGB16 Interpretation = C.VIPS_INTERPRETATION_RGB16 INTERPRETATION_GREY16 Interpretation = C.VIPS_INTERPRETATION_GREY16 INTERPRETATION_scRGB Interpretation = C.VIPS_INTERPRETATION_scRGB INTERPRETATION_LAB Interpretation = C.VIPS_INTERPRETATION_LAB INTERPRETATION_XYZ Interpretation = C.VIPS_INTERPRETATION_XYZ )
func ImageInterpretation ¶
func ImageInterpretation(buf []byte) (Interpretation, error)
Get the image interpretation type See: http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/VipsImage.html#VipsInterpretation
type Options ¶
type Options struct { Height int Width int AreaHeight int AreaWidth int Top int Left int Extend int Quality int Compression int Zoom int Crop bool Enlarge bool Embed bool Flip bool Flop bool Force bool NoAutoRotate bool NoProfile bool Interlace bool Rotate Angle Background Color Gravity Gravity Watermark Watermark Type ImageType Interpolator Interpolator Interpretation Interpretation GaussianBlur GaussianBlur Sharpen Sharpen }
Supported image transformation options
type VipsMemoryInfo ¶
func VipsMemory ¶
func VipsMemory() VipsMemoryInfo
Get memory info stats from vips (cache size, memory allocs...)