vips

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 21 Imported by: 97

Documentation

Overview

Package vips provides go bindings for libvips, a fast image processing library.

Index

Constants

View Source
const DefaultFont = "sans 10"

DefaultFont is the default font to be used for label texts created by govips

View Source
const GaussBlurDefaultMinAMpl = 0.2

Variables

View Source
var (
	// Version is the full libvips version string (x.y.z)
	Version = C.GoString(C.vips_version_string())

	// MajorVersion is the libvips major component of the version string (x in x.y.z)
	MajorVersion = int(C.vips_version(0))

	// MinorVersion is the libvips minor component of the version string (y in x.y.z)
	MinorVersion = int(C.vips_version(1))

	// MicroVersion is the libvips micro component of the version string (z in x.y.z)
	// Also known as patch version
	MicroVersion = int(C.vips_version(2))
)
View Source
var (
	SRGBV2MicroICCProfilePath        = filepath.Join(temporaryDirectory, "srgb_v2_micro.icc")
	SGrayV2MicroICCProfilePath       = filepath.Join(temporaryDirectory, "sgray_v2_micro.icc")
	SRGBIEC6196621ICCProfilePath     = filepath.Join(temporaryDirectory, "srgb_iec61966_2_1.icc")
	GenericGrayGamma22ICCProfilePath = filepath.Join(temporaryDirectory, "generic_gray_gamma_2_2.icc")
)
View Source
var (
	// ErrUnsupportedImageFormat when image type is unsupported
	ErrUnsupportedImageFormat = errors.New("unsupported image format")
)
View Source
var ImageTypes = map[ImageType]string{
	ImageTypeGIF:    "gif",
	ImageTypeJPEG:   "jpeg",
	ImageTypeMagick: "magick",
	ImageTypePDF:    "pdf",
	ImageTypePNG:    "png",
	ImageTypeSVG:    "svg",
	ImageTypeTIFF:   "tiff",
	ImageTypeWEBP:   "webp",
	ImageTypeHEIF:   "heif",
	ImageTypeBMP:    "bmp",
	ImageTypeAVIF:   "heif",
	ImageTypeJP2K:   "jp2k",
	ImageTypeJXL:    "jxl",
}

ImageTypes defines the various image types supported by govips

Functions

func ClearCache

func ClearCache()

ClearCache drops the whole operation cache, handy for leak tracking.

func IsTypeSupported

func IsTypeSupported(imageType ImageType) bool

IsTypeSupported checks whether given image type is supported by govips

func LoggingSettings added in v2.1.0

func LoggingSettings(handler LoggingHandlerFunction, verbosity LogLevel)

LoggingSettings sets the logging handler and logging verbosity for govips. The handler function is the function which will be called for each log message. You can define one yourself to log somewhere else besides the default (stderr). Use nil as handler to use standard logging handler. Verbosity is the minimum logLevel you want to log. Default is logLevelInfo due to backwards compatibility but it's quite verbose for a library. Suggest setting it to at least logLevelWarning. Use logLevelDebug for debugging.

func Pixelate added in v2.10.0

func Pixelate(imageRef *ImageRef, factor float64) (err error)

Pixelate applies a simple pixelate filter to the image

func PrintCache

func PrintCache()

PrintCache prints the whole operation cache to stdout for debugging purposes.

func PrintObjectReport

func PrintObjectReport(label string)

PrintObjectReport outputs all of the current internal objects in libvips

func ReadRuntimeStats

func ReadRuntimeStats(stats *RuntimeStats)

ReadRuntimeStats returns operation counts for govips

func ReadVipsMemStats

func ReadVipsMemStats(stats *MemoryStats)

ReadVipsMemStats returns various memory statistics such as allocated memory and open files.

func Shutdown

func Shutdown()

Shutdown libvips

func ShutdownThread

func ShutdownThread()

ShutdownThread clears the cache for for the given thread. This needs to be called when a thread using vips exits.

func Startup

func Startup(config *Config)

Startup sets up the libvips support and ensures the versions are correct. Pass in nil for default configuration.

Types

type Align

type Align int

Align represents VIPS_ALIGN

const (
	AlignLow    Align = C.VIPS_ALIGN_LOW
	AlignCenter Align = C.VIPS_ALIGN_CENTRE
	AlignHigh   Align = C.VIPS_ALIGN_HIGH
)

Direction enum

type Angle

type Angle int

Angle represents VIPS_ANGLE type

const (
	Angle0   Angle = C.VIPS_ANGLE_D0
	Angle90  Angle = C.VIPS_ANGLE_D90
	Angle180 Angle = C.VIPS_ANGLE_D180
	Angle270 Angle = C.VIPS_ANGLE_D270
)

Angle enum

func GetRotationAngleFromExif

func GetRotationAngleFromExif(orientation int) (Angle, bool)

GetRotationAngleFromExif returns the angle which the image is currently rotated in. First returned value is the angle and second is a boolean indicating whether image is flipped. This is based on the EXIF orientation tag standard. If no proper orientation number is provided, the picture will be assumed to be upright.

type Angle45

type Angle45 int

Angle45 represents VIPS_ANGLE45 type

const (
	Angle45_0   Angle45 = C.VIPS_ANGLE45_D0
	Angle45_45  Angle45 = C.VIPS_ANGLE45_D45
	Angle45_90  Angle45 = C.VIPS_ANGLE45_D90
	Angle45_135 Angle45 = C.VIPS_ANGLE45_D135
	Angle45_180 Angle45 = C.VIPS_ANGLE45_D180
	Angle45_225 Angle45 = C.VIPS_ANGLE45_D225
	Angle45_270 Angle45 = C.VIPS_ANGLE45_D270
	Angle45_315 Angle45 = C.VIPS_ANGLE45_D315
)

Angle45 enum

type AvifExportParams added in v2.7.0

type AvifExportParams struct {
	StripMetadata bool
	Quality       int
	Bitdepth      int
	Effort        int
	Lossless      bool

	// DEPRECATED - Use Effort instead.
	Speed int
}

AvifExportParams are options when exporting an AVIF to file or buffer.

func NewAvifExportParams added in v2.7.0

func NewAvifExportParams() *AvifExportParams

NewAvifExportParams creates default values for an export of an AVIF image.

type BandFormat

type BandFormat int

BandFormat represents VIPS_FORMAT type

const (
	BandFormatNotSet    BandFormat = C.VIPS_FORMAT_NOTSET
	BandFormatUchar     BandFormat = C.VIPS_FORMAT_UCHAR
	BandFormatChar      BandFormat = C.VIPS_FORMAT_CHAR
	BandFormatUshort    BandFormat = C.VIPS_FORMAT_USHORT
	BandFormatShort     BandFormat = C.VIPS_FORMAT_SHORT
	BandFormatUint      BandFormat = C.VIPS_FORMAT_UINT
	BandFormatInt       BandFormat = C.VIPS_FORMAT_INT
	BandFormatFloat     BandFormat = C.VIPS_FORMAT_FLOAT
	BandFormatComplex   BandFormat = C.VIPS_FORMAT_COMPLEX
	BandFormatDouble    BandFormat = C.VIPS_FORMAT_DOUBLE
	BandFormatDpComplex BandFormat = C.VIPS_FORMAT_DPCOMPLEX
)

BandFormat enum

type BlendMode

type BlendMode int

BlendMode gives the various Porter-Duff and PDF blend modes. See https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode

Constants define the various Porter-Duff and PDF blend modes. See https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode

type BoolParameter added in v2.8.0

type BoolParameter struct {
	Parameter
}

func (*BoolParameter) Get added in v2.8.0

func (p *BoolParameter) Get() bool

func (*BoolParameter) Set added in v2.8.0

func (p *BoolParameter) Set(v bool)

type Coding

type Coding int

Coding represents VIPS_CODING type

const (
	CodingError Coding = C.VIPS_CODING_ERROR
	CodingNone  Coding = C.VIPS_CODING_NONE
	CodingLABQ  Coding = C.VIPS_CODING_LABQ
	CodingRAD   Coding = C.VIPS_CODING_RAD
)

Coding enum

type Color

type Color struct {
	R, G, B uint8
}

Color represents an RGB

type ColorRGBA added in v2.4.0

type ColorRGBA struct {
	R, G, B, A uint8
}

ColorRGBA represents an RGB with alpha channel (A)

type Config

type Config struct {
	ConcurrencyLevel int
	MaxCacheFiles    int
	MaxCacheMem      int
	MaxCacheSize     int
	ReportLeaks      bool
	CacheTrace       bool
	CollectStats     bool
}

Config allows fine-tuning of libvips library

type Direction

type Direction int

Direction represents VIPS_DIRECTION type

const (
	DirectionHorizontal Direction = C.VIPS_DIRECTION_HORIZONTAL
	DirectionVertical   Direction = C.VIPS_DIRECTION_VERTICAL
)

Direction enum

type ExportParams

type ExportParams struct {
	Format             ImageType
	Quality            int
	Compression        int
	Interlaced         bool
	Lossless           bool
	Effort             int
	StripMetadata      bool
	OptimizeCoding     bool          // jpeg param
	SubsampleMode      SubsampleMode // jpeg param
	TrellisQuant       bool          // jpeg param
	OvershootDeringing bool          // jpeg param
	OptimizeScans      bool          // jpeg param
	QuantTable         int           // jpeg param
	Speed              int           // avif param
}

ExportParams are options when exporting an image to file or buffer. Deprecated: Use format-specific params

func NewDefaultExportParams

func NewDefaultExportParams() *ExportParams

NewDefaultExportParams creates default values for an export when image type is not JPEG, PNG or WEBP. By default, govips creates interlaced, lossy images with a quality of 80/100 and compression of 6/10. As these are default values for a wide variety of image formats, their application varies. Some formats use the quality parameters, some compression, etc. Deprecated: Use format-specific params

func NewDefaultJPEGExportParams

func NewDefaultJPEGExportParams() *ExportParams

NewDefaultJPEGExportParams creates default values for an export of a JPEG image. By default, govips creates interlaced JPEGs with a quality of 80/100. Deprecated: Use NewJpegExportParams

func NewDefaultPNGExportParams

func NewDefaultPNGExportParams() *ExportParams

NewDefaultPNGExportParams creates default values for an export of a PNG image. By default, govips creates non-interlaced PNGs with a compression of 6/10. Deprecated: Use NewPngExportParams

func NewDefaultWEBPExportParams

func NewDefaultWEBPExportParams() *ExportParams

NewDefaultWEBPExportParams creates default values for an export of a WEBP image. By default, govips creates lossy images with a quality of 75/100. Deprecated: Use NewWebpExportParams

type ExtendStrategy

type ExtendStrategy int

ExtendStrategy represents VIPS_EXTEND type

ExtendStrategy enum

type Float64Parameter added in v2.8.0

type Float64Parameter struct {
	Parameter
}

func (*Float64Parameter) Get added in v2.8.0

func (p *Float64Parameter) Get() float64

func (*Float64Parameter) Set added in v2.8.0

func (p *Float64Parameter) Set(v float64)

type GifExportParams added in v2.6.0

type GifExportParams struct {
	StripMetadata bool
	Quality       int
	Dither        float64
	Effort        int
	Bitdepth      int
}

GifExportParams are options when exporting a GIF to file or buffer Please note that if vips version is above 8.12, then `vips_gifsave_buffer` is used, and only `Dither`, `Effort`, `Bitdepth` is used. If vips version is below 8.12, then `vips_magicksave_buffer` is used, and only `Bitdepth`, `Quality` is used. StripMetadata does nothing to Gif images.

func NewGifExportParams added in v2.6.0

func NewGifExportParams() *GifExportParams

NewGifExportParams creates default values for an export of a GIF image.

type HeifExportParams added in v2.4.0

type HeifExportParams struct {
	Quality  int
	Bitdepth int
	Effort   int
	Lossless bool
}

HeifExportParams are options when exporting a HEIF to file or buffer

func NewHeifExportParams added in v2.4.0

func NewHeifExportParams() *HeifExportParams

NewHeifExportParams creates default values for an export of a HEIF image.

type ImageComposite added in v2.2.0

type ImageComposite struct {
	Image     *ImageRef
	BlendMode BlendMode
	X, Y      int
}

ImageComposite image to composite param

type ImageMetadata

type ImageMetadata struct {
	Format      ImageType
	Width       int
	Height      int
	Colorspace  Interpretation
	Orientation int
	Pages       int
}

ImageMetadata is a data structure holding the width, height, orientation and other metadata of the picture.

type ImageRef

type ImageRef struct {
	// contains filtered or unexported fields
}

ImageRef contains a libvips image and manages its lifecycle.

func Black added in v2.4.0

func Black(width, height int) (*ImageRef, error)

Black creates a new black image of the specified size

func Identity added in v2.5.0

func Identity(ushort bool) (*ImageRef, error)

Identity creates an identity lookup table, which will leave an image unchanged when applied with Maplut. Each entry in the table has a value equal to its position.

func LoadImageFromBuffer added in v2.8.0

func LoadImageFromBuffer(buf []byte, params *ImportParams) (*ImageRef, error)

LoadImageFromBuffer loads an image buffer and creates a new Image

func LoadImageFromFile added in v2.10.0

func LoadImageFromFile(file string, params *ImportParams) (*ImageRef, error)

LoadImageFromFile loads an image from file and creates a new ImageRef

func LoadThumbnailFromBuffer added in v2.11.0

func LoadThumbnailFromBuffer(buf []byte, width, height int, crop Interesting, size Size, params *ImportParams) (*ImageRef, error)

LoadThumbnailFromBuffer loads an image buffer and creates a new Image with thumbnail crop and size

func LoadThumbnailFromFile added in v2.11.0

func LoadThumbnailFromFile(file string, width, height int, crop Interesting, size Size, params *ImportParams) (*ImageRef, error)

LoadThumbnailFromFile loads an image from file and creates a new ImageRef with thumbnail crop and size

func NewImageFromBuffer

func NewImageFromBuffer(buf []byte) (*ImageRef, error)

NewImageFromBuffer loads an image buffer and creates a new Image

func NewImageFromFile

func NewImageFromFile(file string) (*ImageRef, error)

NewImageFromFile loads an image from file and creates a new ImageRef

func NewImageFromReader

func NewImageFromReader(r io.Reader) (*ImageRef, error)

NewImageFromReader loads an ImageRef from the given reader

func NewThumbnailFromBuffer added in v2.9.0

func NewThumbnailFromBuffer(buf []byte, width, height int, crop Interesting) (*ImageRef, error)

NewThumbnailFromBuffer loads an image buffer and creates a new Image with thumbnail crop

func NewThumbnailFromFile added in v2.9.0

func NewThumbnailFromFile(file string, width, height int, crop Interesting) (*ImageRef, error)

NewThumbnailFromFile loads an image from file and creates a new ImageRef with thumbnail crop

func NewThumbnailWithSizeFromBuffer added in v2.9.0

func NewThumbnailWithSizeFromBuffer(buf []byte, width, height int, crop Interesting, size Size) (*ImageRef, error)

NewThumbnailWithSizeFromBuffer loads an image buffer and creates a new Image with thumbnail crop and size

func NewThumbnailWithSizeFromFile added in v2.9.0

func NewThumbnailWithSizeFromFile(file string, width, height int, crop Interesting, size Size) (*ImageRef, error)

NewThumbnailWithSizeFromFile loads an image from file and creates a new ImageRef with thumbnail crop and size

func XYZ added in v2.3.0

func XYZ(width, height int) (*ImageRef, error)

XYZ creates a two-band uint32 image where the elements in the first band have the value of their x coordinate and elements in the second band have their y coordinate.

func (*ImageRef) Add added in v2.3.0

func (r *ImageRef) Add(addend *ImageRef) error

Add calculates a sum of the image + addend and stores it back in the image

func (*ImageRef) AddAlpha

func (r *ImageRef) AddAlpha() error

AddAlpha adds an alpha channel to the associated image.

func (*ImageRef) ArrayJoin added in v2.8.0

func (r *ImageRef) ArrayJoin(images []*ImageRef, across int) error

ArrayJoin joins an array of images together wrapping at each n images

func (*ImageRef) AutoRotate

func (r *ImageRef) AutoRotate() error

AutoRotate rotates the image upright based on the EXIF Orientation tag. It also resets the orientation information in the EXIF tag to be 1 (i.e. upright). N.B. libvips does not flip images currently (i.e. no support for orientations 2, 4, 5 and 7). N.B. due to the HEIF image standard, HEIF images are always autorotated by default on load. Thus, calling AutoRotate for HEIF images is not needed. todo: use https://www.libvips.org/API/current/libvips-conversion.html#vips-autorot-remove-angle

func (*ImageRef) Average added in v2.5.0

func (r *ImageRef) Average() (float64, error)

Average finds the average value in an image

func (*ImageRef) BandFormat

func (r *ImageRef) BandFormat() BandFormat

BandFormat returns the current band format

func (*ImageRef) BandJoin

func (r *ImageRef) BandJoin(images ...*ImageRef) error

BandJoin joins a set of images together, bandwise.

func (*ImageRef) BandJoinConst added in v2.4.0

func (r *ImageRef) BandJoinConst(constants []float64) error

BandJoinConst appends a set of constant bands to an image.

func (*ImageRef) BandSplit added in v2.13.0

func (r *ImageRef) BandSplit() ([]*ImageRef, error)

BandSplit split an n-band image into n separate images..

func (*ImageRef) Bands

func (r *ImageRef) Bands() int

Bands returns the number of bands for this image.

func (*ImageRef) Cast added in v2.5.0

func (r *ImageRef) Cast(format BandFormat) error

Cast converts the image to a target band format

func (*ImageRef) Close

func (r *ImageRef) Close()

Close manually closes the image and frees the memory. Calling Close() is optional. Images are automatically closed by GC. However, in high volume applications the GC can't keep up with the amount of memory, so you might want to manually close the images.

func (*ImageRef) Coding

func (r *ImageRef) Coding() Coding

Coding returns the image coding

func (*ImageRef) ColorSpace

func (r *ImageRef) ColorSpace() Interpretation

ColorSpace returns the interpretation of the current color space. Alias to Interpretation().

func (*ImageRef) Composite

func (r *ImageRef) Composite(overlay *ImageRef, mode BlendMode, x, y int) error

Composite composites the given overlay image on top of the associated image with provided blending mode.

func (*ImageRef) CompositeMulti added in v2.2.0

func (r *ImageRef) CompositeMulti(ins []*ImageComposite) error

CompositeMulti composites the given overlay image on top of the associated image with provided blending mode.

func (*ImageRef) Copy

func (r *ImageRef) Copy() (*ImageRef, error)

Copy creates a new copy of the given image.

func (*ImageRef) CopyChangingInterpretation added in v2.13.0

func (r *ImageRef) CopyChangingInterpretation(interpretation Interpretation) (*ImageRef, error)

Copy creates a new copy of the given image with the interpretation.

func (*ImageRef) CopyChangingResolution added in v2.13.0

func (r *ImageRef) CopyChangingResolution(xres, yres float64) (*ImageRef, error)

Copy creates a new copy of the given image with the new X and Y resolution (PPI).

func (*ImageRef) Crop added in v2.14.0

func (r *ImageRef) Crop(left int, top int, width int, height int) error

Crop will crop the image based on coordinate and box size

func (*ImageRef) Divide added in v2.3.0

func (r *ImageRef) Divide(denominator *ImageRef) error

Divide calculates the product of the image / denominator and stores it back in the image

func (*ImageRef) DrawRect added in v2.4.0

func (r *ImageRef) DrawRect(ink ColorRGBA, left int, top int, width int, height int, fill bool) error

DrawRect draws an (optionally filled) rectangle with a single colour

func (*ImageRef) Embed

func (r *ImageRef) Embed(left, top, width, height int, extend ExtendStrategy) error

Embed embeds the given picture in a new one, i.e. the opposite of ExtractArea

func (*ImageRef) EmbedBackground added in v2.9.0

func (r *ImageRef) EmbedBackground(left, top, width, height int, backgroundColor *Color) error

EmbedBackground embeds the given picture with a background color

func (*ImageRef) EmbedBackgroundRGBA added in v2.11.0

func (r *ImageRef) EmbedBackgroundRGBA(left, top, width, height int, backgroundColor *ColorRGBA) error

EmbedBackgroundRGBA embeds the given picture with a background rgba color

func (*ImageRef) Export

func (r *ImageRef) Export(params *ExportParams) ([]byte, *ImageMetadata, error)

Export creates a byte array of the image for use. The function returns a byte array that can be written to a file e.g. via os.WriteFile(). N.B. govips does not currently have built-in support for directly exporting to a file. The function also returns a copy of the image metadata as well as an error. Deprecated: Use ExportNative or format-specific Export methods

func (*ImageRef) ExportAvif added in v2.7.0

func (r *ImageRef) ExportAvif(params *AvifExportParams) ([]byte, *ImageMetadata, error)

ExportAvif exports the image as AVIF to a buffer.

func (*ImageRef) ExportGIF added in v2.6.0

func (r *ImageRef) ExportGIF(params *GifExportParams) ([]byte, *ImageMetadata, error)

ExportGIF exports the image as GIF to a buffer.

func (*ImageRef) ExportHeif added in v2.4.0

func (r *ImageRef) ExportHeif(params *HeifExportParams) ([]byte, *ImageMetadata, error)

ExportHeif exports the image as HEIF to a buffer.

func (*ImageRef) ExportJp2k added in v2.8.0

func (r *ImageRef) ExportJp2k(params *Jp2kExportParams) ([]byte, *ImageMetadata, error)

ExportJp2k exports the image as JPEG2000 to a buffer.

func (*ImageRef) ExportJpeg added in v2.4.0

func (r *ImageRef) ExportJpeg(params *JpegExportParams) ([]byte, *ImageMetadata, error)

ExportJpeg exports the image as JPEG to a buffer.

func (*ImageRef) ExportJxl added in v2.14.0

func (r *ImageRef) ExportJxl(params *JxlExportParams) ([]byte, *ImageMetadata, error)

ExportJxl exports the image as JPEG XL to a buffer.

func (*ImageRef) ExportNative added in v2.4.0

func (r *ImageRef) ExportNative() ([]byte, *ImageMetadata, error)

ExportNative exports the image to a buffer based on its native format with default parameters.

func (*ImageRef) ExportPng added in v2.4.0

func (r *ImageRef) ExportPng(params *PngExportParams) ([]byte, *ImageMetadata, error)

ExportPng exports the image as PNG to a buffer.

func (*ImageRef) ExportTiff added in v2.4.0

func (r *ImageRef) ExportTiff(params *TiffExportParams) ([]byte, *ImageMetadata, error)

ExportTiff exports the image as TIFF to a buffer.

func (*ImageRef) ExportWebp added in v2.4.0

func (r *ImageRef) ExportWebp(params *WebpExportParams) ([]byte, *ImageMetadata, error)

ExportWebp exports the image as WEBP to a buffer.

func (*ImageRef) ExtractArea

func (r *ImageRef) ExtractArea(left, top, width, height int) error

ExtractArea crops the image to a specified area

func (*ImageRef) ExtractBand

func (r *ImageRef) ExtractBand(band int, num int) error

ExtractBand extracts one or more bands out of the image (replacing the associated ImageRef)

func (*ImageRef) ExtractBandToImage added in v2.13.0

func (r *ImageRef) ExtractBandToImage(band int, num int) (*ImageRef, error)

ExtractBandToImage extracts one or more bands out of the image to a new image

func (*ImageRef) FindTrim added in v2.6.0

func (r *ImageRef) FindTrim(threshold float64, backgroundColor *Color) (int, int, int, int, error)

FindTrim returns the bounding box of the non-border part of the image Returned values are left, top, width, height

func (*ImageRef) Flatten

func (r *ImageRef) Flatten(backgroundColor *Color) error

Flatten removes the alpha channel from the image and replaces it with the background color

func (*ImageRef) Flip

func (r *ImageRef) Flip(direction Direction) error

Flip flips the image either horizontally or vertically based on the parameter

func (*ImageRef) Format

func (r *ImageRef) Format() ImageType

Format returns the current format of the vips image.

func (*ImageRef) Gamma added in v2.15.0

func (r *ImageRef) Gamma(gamma float64) error

Adjusts the image's gamma value. See https://www.libvips.org/API/current/libvips-conversion.html#vips-gamma

func (*ImageRef) GaussianBlur

func (r *ImageRef) GaussianBlur(sigmas ...float64) error

GaussianBlur blurs the image add support minAmpl

func (*ImageRef) GetAsString added in v2.13.0

func (r *ImageRef) GetAsString(name string) string

func (*ImageRef) GetBlob added in v2.13.0

func (r *ImageRef) GetBlob(name string) []byte

func (*ImageRef) GetDouble added in v2.13.0

func (r *ImageRef) GetDouble(name string) float64

func (*ImageRef) GetExif added in v2.13.0

func (r *ImageRef) GetExif() map[string]string

func (*ImageRef) GetFields added in v2.13.0

func (r *ImageRef) GetFields() []string

func (*ImageRef) GetICCProfile added in v2.13.0

func (r *ImageRef) GetICCProfile() []byte

GetICCProfile retrieves the ICC profile data (if any) from the image.

func (*ImageRef) GetInt added in v2.13.0

func (r *ImageRef) GetInt(name string) int

func (*ImageRef) GetOrientation deprecated

func (r *ImageRef) GetOrientation() int

Deprecated: use Orientation() instead

func (*ImageRef) GetPageHeight added in v2.10.0

func (r *ImageRef) GetPageHeight() int

GetPageHeight return the height of a single page Deprecated use PageHeight() instead

func (*ImageRef) GetPages deprecated added in v2.6.0

func (r *ImageRef) GetPages() int

Deprecated: use Pages() instead

func (*ImageRef) GetPoint added in v2.8.0

func (r *ImageRef) GetPoint(x int, y int) ([]float64, error)

GetPoint reads a single pixel on an image. The pixel values are returned in a slice of length n.

func (*ImageRef) GetString added in v2.13.0

func (r *ImageRef) GetString(name string) string

func (*ImageRef) Grid added in v2.10.0

func (r *ImageRef) Grid(tileHeight, across, down int) error

Grid tiles the image pages into a matrix across*down

func (*ImageRef) HasAlpha

func (r *ImageRef) HasAlpha() bool

HasAlpha returns if the image has an alpha layer.

func (*ImageRef) HasExif added in v2.8.0

func (r *ImageRef) HasExif() bool

func (*ImageRef) HasICCProfile

func (r *ImageRef) HasICCProfile() bool

HasICCProfile checks whether the image has an ICC profile embedded. Alias to HasProfile

func (*ImageRef) HasIPTC

func (r *ImageRef) HasIPTC() bool

HasIPTC returns a boolean whether the image in question has IPTC data associated with it.

func (*ImageRef) HasProfile

func (r *ImageRef) HasProfile() bool

HasProfile returns if the image has an ICC profile embedded.

func (*ImageRef) Height

func (r *ImageRef) Height() int

Height returns the height of this image.

func (*ImageRef) HistogramCumulative added in v2.14.0

func (r *ImageRef) HistogramCumulative() error

HistogramCumulative form cumulative histogram.

func (*ImageRef) HistogramEntropy added in v2.14.0

func (r *ImageRef) HistogramEntropy() (float64, error)

HistogramEntropy estimate image entropy from a histogram. Entropy is calculated as: `-sum(p * log2(p))` where p is histogram-value / sum-of-histogram-values.

func (*ImageRef) HistogramFind added in v2.14.0

func (r *ImageRef) HistogramFind() error

HistogramFind find the histogram the image. Find the histogram for all bands (producing a one-band histogram). char and uchar images are cast to uchar before histogramming, all other image types are cast to ushort.

func (*ImageRef) HistogramNormalise added in v2.14.0

func (r *ImageRef) HistogramNormalise() error

HistogramNormalise The maximum of each band becomes equal to the maximum index, so for example the max for a uchar image becomes 255. Normalise each band separately.

func (*ImageRef) ImageFields added in v2.8.0

func (r *ImageRef) ImageFields() []string

func (*ImageRef) Insert added in v2.6.0

func (r *ImageRef) Insert(sub *ImageRef, x, y int, expand bool, background *ColorRGBA) error

Insert draws the image on top of the associated image at the given coordinates.

func (*ImageRef) Interpretation

func (r *ImageRef) Interpretation() Interpretation

Interpretation returns the current interpretation of the color space of the image.

func (*ImageRef) Invert

func (r *ImageRef) Invert() error

Invert inverts the image

func (*ImageRef) IsColorSpaceSupported

func (r *ImageRef) IsColorSpaceSupported() bool

IsColorSpaceSupported returns a boolean whether the image's color space is supported by libvips.

func (*ImageRef) Join added in v2.8.0

func (r *ImageRef) Join(in *ImageRef, dir Direction) error

Join joins this image with another in the direction specified

func (*ImageRef) Label

func (r *ImageRef) Label(labelParams *LabelParams) error

Label overlays a label on top of the image

func (*ImageRef) Linear

func (r *ImageRef) Linear(a, b []float64) error

Linear passes an image through a linear transformation (i.e. output = input * a + b). See https://libvips.github.io/libvips/API/current/libvips-arithmetic.html#vips-linear

func (*ImageRef) Linear1

func (r *ImageRef) Linear1(a, b float64) error

Linear1 runs Linear() with a single constant. See https://libvips.github.io/libvips/API/current/libvips-arithmetic.html#vips-linear1

func (*ImageRef) Mapim added in v2.3.0

func (r *ImageRef) Mapim(index *ImageRef) error

Mapim resamples an image using index to look up pixels

func (*ImageRef) Maplut added in v2.5.0

func (r *ImageRef) Maplut(lut *ImageRef) error

Maplut maps an image through another image acting as a LUT (Look Up Table)

func (*ImageRef) Metadata

func (r *ImageRef) Metadata() *ImageMetadata

Metadata returns the metadata (ImageMetadata struct) of the associated ImageRef

func (*ImageRef) Modulate

func (r *ImageRef) Modulate(brightness, saturation, hue float64) error

Modulate the colors

func (*ImageRef) ModulateHSV

func (r *ImageRef) ModulateHSV(brightness, saturation float64, hue int) error

ModulateHSV modulates the image HSV values based on the supplier parameters.

func (*ImageRef) Multiply added in v2.3.0

func (r *ImageRef) Multiply(multiplier *ImageRef) error

Multiply calculates the product of the image * multiplier and stores it back in the image

func (*ImageRef) OffsetX

func (r *ImageRef) OffsetX() int

OffsetX returns the X offset

func (*ImageRef) OffsetY

func (r *ImageRef) OffsetY() int

OffsetY returns the Y offset

func (*ImageRef) OptimizeICCProfile

func (r *ImageRef) OptimizeICCProfile() error

OptimizeICCProfile optimizes the ICC color profile of the image. For two color channel images, it sets a grayscale profile. For color images, it sets a CMYK or non-CMYK profile based on the image metadata.

func (*ImageRef) Orientation added in v2.10.0

func (r *ImageRef) Orientation() int

Orientation returns the orientation number as it appears in the EXIF, if present

func (*ImageRef) OriginalFormat added in v2.13.0

func (r *ImageRef) OriginalFormat() ImageType

OriginalFormat returns the original format of the image when loaded. In some cases the loaded image is converted on load, for example, a BMP is automatically converted to PNG This method returns the format of the original buffer, as opposed to Format() with will return the format of the currently held buffer content.

func (*ImageRef) PageDelay added in v2.11.0

func (r *ImageRef) PageDelay() ([]int, error)

PageDelay get the page delay array for animation

func (*ImageRef) PageHeight added in v2.10.0

func (r *ImageRef) PageHeight() int

PageHeight return the height of a single page

func (*ImageRef) Pages added in v2.10.0

func (r *ImageRef) Pages() int

Pages returns the number of pages in the Image For animated images this corresponds to the number of frames

func (*ImageRef) PremultiplyAlpha

func (r *ImageRef) PremultiplyAlpha() error

PremultiplyAlpha premultiplies the alpha channel. See https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-premultiply

func (*ImageRef) Rank added in v2.6.0

func (r *ImageRef) Rank(width int, height int, index int) error

Rank does rank filtering on an image. A window of size width by height is passed over the image. At each position, the pixels inside the window are sorted into ascending order and the pixel at position index is output. index numbers from 0.

func (*ImageRef) Recomb added in v2.14.0

func (r *ImageRef) Recomb(matrix [][]float64) error

Recomb recombines the image bands using the matrix provided

func (*ImageRef) RemoveICCProfile

func (r *ImageRef) RemoveICCProfile() error

RemoveICCProfile removes the ICC Profile information from the image. Typically, browsers and other software assume images without profile to be in the sRGB color space.

func (*ImageRef) RemoveMetadata

func (r *ImageRef) RemoveMetadata(keep ...string) error

RemoveMetadata removes the EXIF metadata from the image. N.B. this function won't remove the ICC profile, orientation and pages metadata because govips needs it to correctly display the image.

func (*ImageRef) RemoveOrientation

func (r *ImageRef) RemoveOrientation() error

RemoveOrientation removes the EXIF orientation information of the image.

func (*ImageRef) Replicate added in v2.10.0

func (r *ImageRef) Replicate(across int, down int) error

Replicate repeats an image many times across and down

func (*ImageRef) ResX

func (r *ImageRef) ResX() float64

ResX returns the X resolution

func (*ImageRef) ResY

func (r *ImageRef) ResY() float64

ResY returns the Y resolution

func (*ImageRef) Resize

func (r *ImageRef) Resize(scale float64, kernel Kernel) error

Resize resizes the image based on the scale, maintaining aspect ratio

func (*ImageRef) ResizeWithVScale

func (r *ImageRef) ResizeWithVScale(hScale, vScale float64, kernel Kernel) error

ResizeWithVScale resizes the image with both horizontal and vertical scaling. The parameters are the scaling factors.

func (*ImageRef) Rotate

func (r *ImageRef) Rotate(angle Angle) error

Rotate rotates the image by multiples of 90 degrees. To rotate by arbitrary angles use Similarity.

func (*ImageRef) SetBlob added in v2.13.0

func (r *ImageRef) SetBlob(name string, data []byte)

func (*ImageRef) SetDouble added in v2.13.0

func (r *ImageRef) SetDouble(name string, f float64)

func (*ImageRef) SetInt added in v2.13.0

func (r *ImageRef) SetInt(name string, i int)

func (*ImageRef) SetOrientation

func (r *ImageRef) SetOrientation(orientation int) error

SetOrientation sets the orientation in the EXIF header of the associated image.

func (*ImageRef) SetPageDelay added in v2.11.0

func (r *ImageRef) SetPageDelay(delay []int) error

SetPageDelay set the page delay array for animation

func (*ImageRef) SetPageHeight added in v2.10.0

func (r *ImageRef) SetPageHeight(height int) error

SetPageHeight set the height of a page For animated images this is used when "unrolling" back to frames

func (*ImageRef) SetPages added in v2.10.0

func (r *ImageRef) SetPages(pages int) error

SetPages sets the number of pages in the Image For animated images this corresponds to the number of frames

func (*ImageRef) SetString added in v2.13.0

func (r *ImageRef) SetString(name string, str string)

func (*ImageRef) Sharpen

func (r *ImageRef) Sharpen(sigma float64, x1 float64, m2 float64) error

Sharpen sharpens the image sigma: sigma of the gaussian x1: flat/jaggy threshold m2: slope for jaggy areas

func (*ImageRef) Similarity added in v2.4.0

func (r *ImageRef) Similarity(scale float64, angle float64, backgroundColor *ColorRGBA,
	idx float64, idy float64, odx float64, ody float64) error

Similarity lets you scale, offset and rotate images by arbitrary angles in a single operation while defining the color of new background pixels. If the input image has no alpha channel, the alpha on `backgroundColor` will be ignored. You can add an alpha channel to an image with `BandJoinConst` (e.g. `img.BandJoinConst([]float64{255})`) or AddAlpha.

func (*ImageRef) SmartCrop added in v2.4.0

func (r *ImageRef) SmartCrop(width int, height int, interesting Interesting) error

SmartCrop will crop the image based on interesting factor

func (*ImageRef) Sobel added in v2.15.0

func (r *ImageRef) Sobel() error

Apply Sobel edge detector to the image.

func (*ImageRef) Stats added in v2.14.0

func (r *ImageRef) Stats() error

Stats find many image statistics in a single pass through the data. Image is changed into a one-band `BandFormatDouble` image of at least 10 columns by n + 1 (where n is number of bands in image in) rows. Columns are statistics, and are, in order: minimum, maximum, sum, sum of squares, mean, standard deviation, x coordinate of minimum, y coordinate of minimum, x coordinate of maximum, y coordinate of maximum.

Row 0 has statistics for all bands together, row 1 has stats for band 1, and so on.

If there is more than one maxima or minima, one of them will be chosen at random.

func (*ImageRef) Thumbnail added in v2.2.0

func (r *ImageRef) Thumbnail(width, height int, crop Interesting) error

Thumbnail resizes the image to the given width and height. crop decides algorithm vips uses to shrink and crop to fill target,

func (*ImageRef) ThumbnailWithSize added in v2.9.0

func (r *ImageRef) ThumbnailWithSize(width, height int, crop Interesting, size Size) error

ThumbnailWithSize resizes the image to the given width and height. crop decides algorithm vips uses to shrink and crop to fill target, size controls upsize, downsize, both or force

func (*ImageRef) ToBytes

func (r *ImageRef) ToBytes() ([]byte, error)

ToBytes writes the image to memory in VIPs format and returns the raw bytes, useful for storage.

func (*ImageRef) ToColorSpace

func (r *ImageRef) ToColorSpace(interpretation Interpretation) error

ToColorSpace changes the color space of the image to the interpretation supplied as the parameter.

func (*ImageRef) ToImage added in v2.4.0

func (r *ImageRef) ToImage(params *ExportParams) (image.Image, error)

ToImage converts a VIPs image to a golang image.Image object, useful for interoperability with other golang libraries

func (*ImageRef) TransformICCProfile added in v2.9.0

func (r *ImageRef) TransformICCProfile(outputProfilePath string) error

TransformICCProfile transforms from the embedded ICC profile of the image to the icc profile at the given path.

func (*ImageRef) TransformICCProfileWithFallback added in v2.15.0

func (r *ImageRef) TransformICCProfileWithFallback(targetProfilePath, fallbackProfilePath string) error

TransformICCProfileWithFallback transforms from the embedded ICC profile of the image to the ICC profile at the given path. The fallback ICC profile is used if the image does not have an embedded ICC profile.

func (*ImageRef) UnpremultiplyAlpha

func (r *ImageRef) UnpremultiplyAlpha() error

UnpremultiplyAlpha unpremultiplies any alpha channel. See https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-unpremultiply

func (*ImageRef) Width

func (r *ImageRef) Width() int

Width returns the width of this image.

func (*ImageRef) Zoom

func (r *ImageRef) Zoom(xFactor int, yFactor int) error

Zoom zooms the image by repeating pixels (fast nearest-neighbour)

type ImageType

type ImageType int

ImageType represents an image type

const (
	ImageTypeUnknown ImageType = C.UNKNOWN
	ImageTypeGIF     ImageType = C.GIF
	ImageTypeJPEG    ImageType = C.JPEG
	ImageTypeMagick  ImageType = C.MAGICK
	ImageTypePDF     ImageType = C.PDF
	ImageTypePNG     ImageType = C.PNG
	ImageTypeSVG     ImageType = C.SVG
	ImageTypeTIFF    ImageType = C.TIFF
	ImageTypeWEBP    ImageType = C.WEBP
	ImageTypeHEIF    ImageType = C.HEIF
	ImageTypeBMP     ImageType = C.BMP
	ImageTypeAVIF    ImageType = C.AVIF
	ImageTypeJP2K    ImageType = C.JP2K
	ImageTypeJXL     ImageType = C.JXL
)

ImageType enum

func DetermineImageType

func DetermineImageType(buf []byte) ImageType

DetermineImageType attempts to determine the image type of the given buffer

func (ImageType) FileExt

func (i ImageType) FileExt() string

FileExt returns the canonical extension for the ImageType

type ImportParams added in v2.8.0

type ImportParams struct {
	AutoRotate  BoolParameter
	FailOnError BoolParameter
	Page        IntParameter
	NumPages    IntParameter
	Density     IntParameter

	JpegShrinkFactor IntParameter
	HeifThumbnail    BoolParameter
	SvgUnlimited     BoolParameter
}

ImportParams are options for loading an image. Some are type-specific. For default loading, use NewImportParams() or specify nil

func NewImportParams added in v2.8.0

func NewImportParams() *ImportParams

NewImportParams creates default ImportParams

func (*ImportParams) OptionString added in v2.11.0

func (i *ImportParams) OptionString() string

OptionString convert import params to option_string

type IntParameter added in v2.8.0

type IntParameter struct {
	Parameter
}

func (*IntParameter) Get added in v2.8.0

func (p *IntParameter) Get() int

func (*IntParameter) Set added in v2.8.0

func (p *IntParameter) Set(v int)

type Intent added in v2.8.0

type Intent int

Intent represents VIPS_INTENT type

const (
	IntentPerceptual Intent = C.VIPS_INTENT_PERCEPTUAL
	IntentRelative   Intent = C.VIPS_INTENT_RELATIVE
	IntentSaturation Intent = C.VIPS_INTENT_SATURATION
	IntentAbsolute   Intent = C.VIPS_INTENT_ABSOLUTE
	IntentLast       Intent = C.VIPS_INTENT_LAST
)

Intent enum

type Interesting added in v2.2.0

type Interesting int

Interesting represents VIPS_INTERESTING type https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsInteresting

const (
	InterestingNone      Interesting = C.VIPS_INTERESTING_NONE
	InterestingCentre    Interesting = C.VIPS_INTERESTING_CENTRE
	InterestingEntropy   Interesting = C.VIPS_INTERESTING_ENTROPY
	InterestingAttention Interesting = C.VIPS_INTERESTING_ATTENTION
	InterestingLow       Interesting = C.VIPS_INTERESTING_LOW
	InterestingHigh      Interesting = C.VIPS_INTERESTING_HIGH
	InterestingAll       Interesting = C.VIPS_INTERESTING_ALL
	InterestingLast      Interesting = C.VIPS_INTERESTING_LAST
)

Interesting constants represent areas of interest which smart cropping will crop based on.

type Interpretation

type Interpretation int

Interpretation represents VIPS_INTERPRETATION type

type Jp2kExportParams added in v2.8.0

type Jp2kExportParams struct {
	Quality       int
	Lossless      bool
	TileWidth     int
	TileHeight    int
	SubsampleMode SubsampleMode
}

Jp2kExportParams are options when exporting an JPEG2000 to file or buffer.

func NewJp2kExportParams added in v2.8.0

func NewJp2kExportParams() *Jp2kExportParams

NewJp2kExportParams creates default values for an export of an JPEG2000 image.

type JpegExportParams added in v2.4.0

type JpegExportParams struct {
	StripMetadata      bool
	Quality            int
	Interlace          bool
	OptimizeCoding     bool
	SubsampleMode      SubsampleMode
	TrellisQuant       bool
	OvershootDeringing bool
	OptimizeScans      bool
	QuantTable         int
}

JpegExportParams are options when exporting a JPEG to file or buffer

func NewJpegExportParams added in v2.4.0

func NewJpegExportParams() *JpegExportParams

NewJpegExportParams creates default values for an export of a JPEG image. By default, govips creates interlaced JPEGs with a quality of 80/100.

type JxlExportParams added in v2.14.0

type JxlExportParams struct {
	Quality  int
	Lossless bool
	Tier     int
	Distance float64
	Effort   int
}

JxlExportParams are options when exporting an JXL to file or buffer.

func NewJxlExportParams added in v2.14.0

func NewJxlExportParams() *JxlExportParams

NewJxlExportParams creates default values for an export of an JXL image.

type Kernel

type Kernel int

Kernel represents VipsKernel type

const (
	KernelAuto     Kernel = -1
	KernelNearest  Kernel = C.VIPS_KERNEL_NEAREST
	KernelLinear   Kernel = C.VIPS_KERNEL_LINEAR
	KernelCubic    Kernel = C.VIPS_KERNEL_CUBIC
	KernelLanczos2 Kernel = C.VIPS_KERNEL_LANCZOS2
	KernelLanczos3 Kernel = C.VIPS_KERNEL_LANCZOS3
	KernelMitchell Kernel = C.VIPS_KERNEL_MITCHELL
)

Kernel enum

type LabelParams

type LabelParams struct {
	Text      string
	Font      string
	Width     Scalar
	Height    Scalar
	OffsetX   Scalar
	OffsetY   Scalar
	Opacity   float32
	Color     Color
	Alignment Align
}

LabelParams represents a text-based label

type LogLevel added in v2.1.0

type LogLevel int

LogLevel is the enum controlling logging message verbosity.

const (
	LogLevelError    LogLevel = C.G_LOG_LEVEL_ERROR
	LogLevelCritical LogLevel = C.G_LOG_LEVEL_CRITICAL
	LogLevelWarning  LogLevel = C.G_LOG_LEVEL_WARNING
	LogLevelMessage  LogLevel = C.G_LOG_LEVEL_MESSAGE
	LogLevelInfo     LogLevel = C.G_LOG_LEVEL_INFO
	LogLevelDebug    LogLevel = C.G_LOG_LEVEL_DEBUG
)

The logging verbosity levels classify and filter logging messages. From most to least verbose, they are debug, info, message, warning, critical and error.

type LoggingHandlerFunction added in v2.1.0

type LoggingHandlerFunction func(messageDomain string, messageLevel LogLevel, message string)

LoggingHandlerFunction is a function which will be called for each log message. By default, govips sends logging messages to os.Stderr. If you want to log elsewhere such as to a file or to a state variable which you inspect yourself, define a new logging handler function and set it via LoggingSettings().

type MemoryStats

type MemoryStats struct {
	Mem     int64
	MemHigh int64
	Files   int64
	Allocs  int64
}

MemoryStats is a data structure that houses various memory statistics from ReadVipsMemStats()

type Parameter added in v2.8.0

type Parameter struct {
	// contains filtered or unexported fields
}

func (*Parameter) IsSet added in v2.8.0

func (p *Parameter) IsSet() bool

type PngExportParams added in v2.4.0

type PngExportParams struct {
	StripMetadata bool
	Compression   int
	Filter        PngFilter
	Interlace     bool
	Quality       int
	Palette       bool
	Dither        float64
	Bitdepth      int
	Profile       string // TODO: Use this param during save
}

PngExportParams are options when exporting a PNG to file or buffer

func NewPngExportParams added in v2.4.0

func NewPngExportParams() *PngExportParams

NewPngExportParams creates default values for an export of a PNG image. By default, govips creates non-interlaced PNGs with a compression of 6/10.

type PngFilter added in v2.13.0

type PngFilter int

PngFilter represents filter algorithms that can be applied before compression. See https://www.w3.org/TR/PNG-Filters.html

type PreMultiplicationState

type PreMultiplicationState struct {
	// contains filtered or unexported fields
}

PreMultiplicationState stores the pre-multiplication band format of the image

type RuntimeStats

type RuntimeStats struct {
	OperationCounts map[string]int64
}

RuntimeStats is a data structure to house a map of govips operation counts

type Scalar

type Scalar struct {
	Value    float64
	Relative bool
}

Scalar is the basic scalar measurement of an image's height, width or offset coordinate.

func ValueOf

func ValueOf(value float64) Scalar

ValueOf takes a floating point value and returns a corresponding Scalar struct

func (*Scalar) Get

func (s *Scalar) Get(base int) float64

Get returns the value of the scalar. Either absolute, or if relative, multiplied by the base given as parameter.

func (*Scalar) GetRounded

func (s *Scalar) GetRounded(base int) int

GetRounded returns the value of the associated Scalar, rounded to the nearest integer, if absolute. If the Scalar is relative, it will be multiplied by the supplied base parameter.

func (*Scalar) IsZero

func (s *Scalar) IsZero() bool

IsZero checkes whether the associated Scalar's value is zero.

func (*Scalar) Set

func (s *Scalar) Set(value float64)

Set sets a float value for the associated Scalar.

func (*Scalar) SetInt

func (s *Scalar) SetInt(value int)

SetInt sets an integer value for the associated Scalar.

func (*Scalar) SetScale

func (s *Scalar) SetScale(f float64)

SetScale sets a float value for the associated Scalar and makes it relative.

type Size added in v2.9.0

type Size int

Size represents VipsSize type

const (
	SizeBoth  Size = C.VIPS_SIZE_BOTH
	SizeUp    Size = C.VIPS_SIZE_UP
	SizeDown  Size = C.VIPS_SIZE_DOWN
	SizeForce Size = C.VIPS_SIZE_FORCE
	SizeLast  Size = C.VIPS_SIZE_LAST
)

type SubsampleMode added in v2.6.0

type SubsampleMode int

SubsampleMode correlates to a libvips subsample mode

const (
	VipsForeignSubsampleAuto SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO
	VipsForeignSubsampleOn   SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_ON
	VipsForeignSubsampleOff  SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
	VipsForeignSubsampleLast SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_LAST
)

SubsampleMode enum correlating to libvips subsample modes

type TiffCompression added in v2.4.0

type TiffCompression int

TiffCompression represents method for compressing a tiff at export

type TiffExportParams added in v2.4.0

type TiffExportParams struct {
	StripMetadata bool
	Quality       int
	Compression   TiffCompression
	Predictor     TiffPredictor
}

TiffExportParams are options when exporting a TIFF to file or buffer

func NewTiffExportParams added in v2.4.0

func NewTiffExportParams() *TiffExportParams

NewTiffExportParams creates default values for an export of a TIFF image.

type TiffPredictor added in v2.5.0

type TiffPredictor int

TiffPredictor represents method for compressing a tiff at export

TiffPredictor enum

type WebpExportParams added in v2.4.0

type WebpExportParams struct {
	StripMetadata   bool
	Quality         int
	Lossless        bool
	NearLossless    bool
	ReductionEffort int
	IccProfile      string
	MinSize         bool
	MinKeyFrames    int
	MaxKeyFrames    int
}

WebpExportParams are options when exporting a WEBP to file or buffer see https://www.libvips.org/API/current/VipsForeignSave.html#vips-webpsave for details on each parameter

func NewWebpExportParams added in v2.4.0

func NewWebpExportParams() *WebpExportParams

NewWebpExportParams creates default values for an export of a WEBP image. By default, govips creates lossy images with a quality of 75/100.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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