The libvips enums

This module contains the various libvips enums as Python classes.

Enums values are represented in pyvips as strings. These classes contain the valid strings for each enum.

class pyvips.enums.BandFormat[source]

BandFormat.

The format used for each band element.

Each corresponds to a native C type for the current machine. For example, enums.BandFormat.USHORT is unsigned short.

NOTSET

invalid setting

Type:

str

UCHAR

unsigned char format

Type:

str

CHAR

char format

Type:

str

USHORT

unsigned short format

Type:

str

SHORT

short format

Type:

str

UINT

unsigned int format

Type:

str

INT

int format

Type:

str

FLOAT

float format

Type:

str

COMPLEX

complex (two floats) format

Type:

str

DOUBLE

double float format

Type:

str

DPCOMPLEX

double complex (two double) format

Type:

str

class pyvips.enums.BlendMode[source]

BlendMode.

The various Porter-Duff and PDF blend modes. See Image.composite(), for example.

The Cairo docs have [a nice explanation of all the blend modes](https://www.cairographics.org/operators).

The non-separable modes are not implemented.

CLEAR

where the second object is drawn, the first is removed

Type:

str

SOURCE

the second object is drawn as if nothing were below

Type:

str

OVER

the image shows what you would expect if you held two semi-transparent slides on top of each other

Type:

str

IN

the first object is removed completely, the second is only drawn where the first was

Type:

str

OUT

the second is drawn only where the first isn’t

Type:

str

ATOP

this leaves the first object mostly intact, but mixes both objects in the overlapping area

Type:

str

DEST

leaves the first object untouched, the second is discarded completely

Type:

str

DEST_OVER

like OVER, but swaps the arguments

Type:

str

DEST_IN

like IN, but swaps the arguments

Type:

str

DEST_OUT

like OUT, but swaps the arguments

Type:

str

DEST_ATOP

like ATOP, but swaps the arguments

Type:

str

XOR

something like a difference operator

Type:

str

ADD

a bit like adding the two images

Type:

str

SATURATE

a bit like the darker of the two

Type:

str

MULTIPLY

at least as dark as the darker of the two inputs

Type:

str

SCREEN

at least as light as the lighter of the inputs

Type:

str

OVERLAY

multiplies or screens colors, depending on the lightness

Type:

str

DARKEN

the darker of each component

Type:

str

LIGHTEN

the lighter of each component

Type:

str

COLOUR_DODGE

brighten first by a factor second

Type:

str

COLOUR_BURN

darken first by a factor of second

Type:

str

HARD_LIGHT

multiply or screen, depending on lightness

Type:

str

SOFT_LIGHT

darken or lighten, depending on lightness

Type:

str

DIFFERENCE

difference of the two

Type:

str

EXCLUSION

somewhat like DIFFERENCE, but lower-contrast

Type:

str

class pyvips.enums.Coding[source]

Coding.

How pixels are coded.

Normally, pixels are uncoded and can be manipulated as you would expect. However some file formats code pixels for compression, and sometimes it’s useful to be able to manipulate images in the coded format.

The gaps in the numbering are historical and must be maintained. Allocate new numbers from the end.

NONE

pixels are not coded

Type:

str

LABQ

pixels encode 3 float CIELAB values as 4 uchar

Type:

str

RAD

pixels encode 3 float RGB as 4 uchar (Radiance coding)

Type:

str

class pyvips.enums.Interpretation[source]

Interpretation.

How the values in an image should be interpreted. For example, a three-band float image of type enums.Interpretation.LAB should have its pixels interpreted as coordinates in CIE Lab space.

RGB and sRGB are treated in the same way. Use the colourspace functions if you want some other behaviour.

The gaps in numbering are historical and must be maintained. Allocate new numbers from the end.

MULTIBAND

generic many-band image

Type:

str

B_W

some kind of single-band image

Type:

str

HISTOGRAM

a 1D image, eg. histogram or lookup table

Type:

str

XYZ

the first three bands are CIE XYZ

Type:

str

LAB

pixels are in CIE Lab space

Type:

str

CMYK

the first four bands are in CMYK space

Type:

str

LABQ

implies enums.Coding.LABQ

Type:

str

RGB

generic RGB space

Type:

str

CMC

a uniform colourspace based on CMC(1:1)

Type:

str

LCH

pixels are in CIE LCh space

Type:

str

LABS

CIE LAB coded as three signed 16-bit values

Type:

str

SRGB

pixels are sRGB

Type:

str

YXY

pixels are CIE Yxy

Type:

str

FOURIER

image is in fourier space

Type:

str

RGB16

generic 16-bit RGB

Type:

str

GREY16

generic 16-bit mono

Type:

str

MATRIX

a matrix

Type:

str

SCRGB

pixels are scRGB

Type:

str

HSV

pixels are HSV

Type:

str

OKLAB

pixels are in Oklab colourspace

Type:

str

OKLCH

pixels are in Oklch colourspace

Type:

str

class pyvips.enums.OperationRelational[source]

OperationRelational.

See also: Image.relational().

EQUAL

==

Type:

str

NOTEQ

!=

Type:

str

LESS

<

Type:

str

LESSEQ

<=

Type:

str

MORE

>

Type:

str

MOREEQ

>=

Type:

str

class pyvips.enums.OperationBoolean[source]

OperationBoolean.

See also: Image.boolean().

AND

&

Type:

str

OR

|

Type:

str

EOR

^

Type:

str

LSHIFT

>>

Type:

str

RSHIFT

<<

Type:

str

class pyvips.enums.OperationMath2[source]

OperationMath2.

See also: Image.math().

POW

pow(left, right)

Type:

str

WOP

pow(right, left)

Type:

str

ATAN2

atan2(left, right)

Type:

str

class pyvips.enums.OperationComplex2[source]

OperationComplex2.

See also: Image.complex2().

CROSS_PHASE

convert to polar coordinates

Type:

str

class pyvips.enums.OperationMath[source]

OperationMath.

See also: Image.math().

SIN

sin(), angles in degrees

Type:

str

COS

cos(), angles in degrees

Type:

str

TAN

tan(), angles in degrees

Type:

str

ASIN

asin(), angles in degrees

Type:

str

ACOS

acos(), angles in degrees

Type:

str

ATAN

atan(), angles in degrees

Type:

str

LOG

log base e

Type:

str

LOG10

log base 10

Type:

str

EXP

e to the something

Type:

str

EXP10

10 to the something

Type:

str

SINH

sinh(), angles in radians

Type:

str

COSH

cosh(), angles in radians

Type:

str

TANH

tanh(), angles in radians

Type:

str

ASINH

asinh(), angles in radians

Type:

str

ACOSH

acosh(), angles in radians

Type:

str

ATANH

atanh(), angles in radians

Type:

str

class pyvips.enums.OperationRound[source]

OperationRound.

See also: Image.round().

RINT

round to nearest

Type:

str

CEIL

the smallest integral value not less than

Type:

str

FLOOR

largest integral value not greater than

Type:

str

class pyvips.enums.OperationComplex[source]

OperationComplex.

See also: Image.complex().

POLAR

convert to polar coordinates

Type:

str

RECT

convert to rectangular coordinates

Type:

str

CONJ

complex conjugate

Type:

str

class pyvips.enums.OperationComplexget[source]

OperationComplexget.

See also: Image.complexget().

REAL

get real component

Type:

str

IMAG

get imaginary component

Type:

str

class pyvips.enums.Combine[source]

Combine.

How to combine values. See Image.compass(), for example.

MAX

take the maximum of the possible values

Type:

str

SUM

sum all the values

Type:

str

MIN

take the minimum value

Type:

str

class pyvips.enums.Access[source]

Access.

The type of access an operation has to supply. See Image.tilecache() and Foreign.

enums.Access.RANDOM means requests can come in any order.

enums.Access.SEQUENTIAL means requests will be top-to-bottom, but with some amount of buffering behind the read point for small non-local accesses.

RANDOM

can read anywhere

Type:

str

SEQUENTIAL

top-to-bottom reading only, but with a small buffer

Type:

str

SEQUENTIAL_UNBUFFERED

deprecated, use enums.Access.SEQUENTIAL instead

Type:

str

class pyvips.enums.Extend[source]

Extend.

See Image.embed(), Image.conv(), Image.affine() and so on.

When the edges of an image are extended, you can specify how you want the extension done.

enums.Extend.BLACK – new pixels are black, ie. all bits are zero.

enums.Extend.COPY – each new pixel takes the value of the nearest edge pixel

enums.Extend.REPEAT – the image is tiled to fill the new area

enums.Extend.MIRROR – the image is reflected and tiled to reduce hash edges

enums.Extend.WHITE – new pixels are white, ie. all bits are set

enums.Extend.BACKGROUND – colour set from the @background property

We have to specify the exact value of each enum member since we have to keep these frozen for back compat with vips7.

::: seealso

Image.embed().

BLACK

extend with black (all 0) pixels

Type:

str

COPY

copy the image edges

Type:

str

REPEAT

repeat the whole image

Type:

str

MIRROR

mirror the whole image

Type:

str

WHITE

extend with white (all bits set) pixels

Type:

str

BACKGROUND

extend with colour from the @background property

Type:

str

class pyvips.enums.CompassDirection[source]

CompassDirection.

A direction on a compass. Used for Image.gravity(), for example.

CENTRE

centre

Type:

str

NORTH

north

Type:

str

EAST

east

Type:

str

SOUTH

south

Type:

str

WEST

west

Type:

str

NORTH_EAST

north-east

Type:

str

SOUTH_EAST

south-east

Type:

str

SOUTH_WEST

south-west

Type:

str

NORTH_WEST

north-west

Type:

str

class pyvips.enums.Direction[source]

Direction.

See Image.flip(), Image.join() and so on.

Operations like Image.flip() need to be told whether to flip left-right or top-bottom.

::: seealso

Image.flip(), Image.join().

HORIZONTAL

left-right

Type:

str

VERTICAL

top-bottom

Type:

str

class pyvips.enums.Align[source]

Align.

See Image.join() and so on.

Operations like Image.join() need to be told whether to align images on the low or high coordinate edge, or centre.

::: seealso

Image.join().

LOW

align low coordinate edge

Type:

str

CENTRE

align centre

Type:

str

HIGH

align high coordinate edge

Type:

str

class pyvips.enums.Interesting[source]

Interesting.

Pick the algorithm vips uses to decide image “interestingness”. This is used by Image.smartcrop(), for example, to decide what parts of the image to keep.

enums.Interesting.NONE and enums.Interesting.LOW mean the same – the crop is positioned at the top or left. enums.Interesting.HIGH positions at the bottom or right.

::: seealso

Image.smartcrop().

NONE

do nothing

Type:

str

CENTRE

just take the centre

Type:

str

ENTROPY

use an entropy measure

Type:

str

ATTENTION

look for features likely to draw human attention

Type:

str

LOW

position the crop towards the low coordinate

Type:

str

HIGH

position the crop towards the high coordinate

Type:

str

ALL

everything is interesting

Type:

str

class pyvips.enums.Angle[source]

Angle.

See Image.rot() and so on.

Fixed rotate angles.

::: seealso

Image.rot().

D0

no rotate

Type:

str

D90

90 degrees clockwise

Type:

str

D180

180 degree rotate

Type:

str

D270

90 degrees anti-clockwise

Type:

str

class pyvips.enums.Angle45[source]

Angle45.

See Image.rot45() and so on.

Fixed rotate angles.

::: seealso

Image.rot45().

D0

no rotate

Type:

str

D45

45 degrees clockwise

Type:

str

D90

90 degrees clockwise

Type:

str

D135

135 degrees clockwise

Type:

str

D180

180 degrees

Type:

str

D225

135 degrees anti-clockwise

Type:

str

D270

90 degrees anti-clockwise

Type:

str

D315

45 degrees anti-clockwise

Type:

str

class pyvips.enums.Precision[source]

Precision.

How accurate an operation should be.

INTEGER

int everywhere

Type:

str

FLOAT

float everywhere

Type:

str

APPROXIMATE

approximate integer output

Type:

str

class pyvips.enums.TextWrap[source]

TextWrap.

Sets the word wrapping style for Image.text() when used with a maximum width.

::: seealso

Image.text().

WORD

wrap at word boundaries

Type:

str

CHAR

wrap at character boundaries

Type:

str

WORD_CHAR

wrap at word boundaries, but fall back to character boundaries if there is not enough space for a full word

Type:

str

NONE

no wrapping

Type:

str

class pyvips.enums.SdfShape[source]

SdfShape.

The SDF to generate,

::: seealso

Image.sdf().

CIRCLE

a circle at @a, radius @r

Type:

str

BOX

a box from @a to @b

Type:

str

ROUNDED_BOX

a box with rounded @corners from @a to @b

Type:

str

LINE

a line from @a to @b

Type:

str

class pyvips.enums.FailOn[source]

FailOn.

How sensitive loaders are to errors, from never stop (very insensitive), to stop on the smallest warning (very sensitive).

Each one implies the ones before it, so enums.FailOn.ERROR implies enums.FailOn.TRUNCATED.

NONE

never stop

Type:

str

TRUNCATED

stop on image truncated, nothing else

Type:

str

ERROR

stop on serious error or truncation

Type:

str

WARNING

stop on anything, even warnings

Type:

str

class pyvips.enums.ForeignPdfPageBox[source]

ForeignPdfPageBox.

Each page of a PDF document can contain multiple page boxes, also known as boundary boxes or print marks.

Each page box defines a region of the complete page that should be rendered. The default region is the crop box.

MEDIA

media box

Type:

str

CROP

crop box

Type:

str

TRIM

trim box

Type:

str

BLEED

bleed box

Type:

str

ART

art box

Type:

str

class pyvips.enums.ForeignPpmFormat[source]

ForeignPpmFormat.

The netpbm file format to save as.

enums.ForeignPpmFormat.PBM images are single bit.

enums.ForeignPpmFormat.PGM images are 8, 16, or 32-bits, one band.

enums.ForeignPpmFormat.PPM images are 8, 16, or 32-bits, three bands.

enums.ForeignPpmFormat.PFM images are 32-bit float pixels.

enums.ForeignPpmFormat.PNM images are anymap images – the image format is used to pick the saver.

PBM

portable bitmap

Type:

str

PGM

portable greymap

Type:

str

PPM

portable pixmap

Type:

str

PFM

portable float map

Type:

str

PNM

portable anymap

Type:

str

class pyvips.enums.ForeignSubsample[source]

ForeignSubsample.

Set subsampling mode.

AUTO

prevent subsampling when quality >= 90

Type:

str

ON

always perform subsampling

Type:

str

OFF

never perform subsampling

Type:

str

class pyvips.enums.ForeignDzLayout[source]

ForeignDzLayout.

What directory layout and metadata standard to use.

DZ

use DeepZoom directory layout

Type:

str

ZOOMIFY

use Zoomify directory layout

Type:

str

GOOGLE

use Google maps directory layout

Type:

str

IIIF

use IIIF v2 directory layout

Type:

str

IIIF3

use IIIF v3 directory layout

Type:

str

class pyvips.enums.ForeignDzDepth[source]

ForeignDzDepth.

How many pyramid layers to create.

ONEPIXEL

create layers down to 1x1 pixel

Type:

str

ONETILE

create layers down to 1x1 tile

Type:

str

ONE

only create a single layer

Type:

str

class pyvips.enums.ForeignDzContainer[source]

ForeignDzContainer.

What container format to use.

FS

write tiles to the filesystem

Type:

str

ZIP

write tiles to a zip file

Type:

str

SZI

write to a szi file

Type:

str

class pyvips.enums.RegionShrink[source]

RegionShrink.

How to calculate the output pixels when shrinking a 2x2 region.

Images with alpha (see Image.hasalpha()) always shrink with enums.RegionShrink.MEAN and pixels scaled by alpha to avoid fringing.

Set the image interpretation to enums.Interpretation.MULTIBAND to treat all bands equally.

MEAN

use the average

Type:

str

MEDIAN

use the median

Type:

str

MODE

use the mode

Type:

str

MAX

use the maximum

Type:

str

MIN

use the minimum

Type:

str

NEAREST

use the top-left pixel

Type:

str

class pyvips.enums.ForeignWebpPreset[source]

ForeignWebpPreset.

Tune lossy encoder settings for different image types.

DEFAULT

default preset

Type:

str

PICTURE

digital picture, like portrait, inner shot

Type:

str

PHOTO

outdoor photograph, with natural lighting

Type:

str

DRAWING

hand or line drawing, with high-contrast details

Type:

str

ICON

small-sized colorful images

Type:

str

TEXT

text-like

Type:

str

class pyvips.enums.ForeignTiffCompression[source]

ForeignTiffCompression.

The compression types supported by the tiff writer.

Use @Q to set the jpeg compression level, default 75.

Use @predictor to set the lzw or deflate prediction, default horizontal.

Use @lossless to set WEBP lossless compression.

Use @level to set webp and zstd compression level.

NONE

no compression

Type:

str

JPEG

jpeg compression

Type:

str

DEFLATE

deflate (zip) compression

Type:

str

PACKBITS

packbits compression

Type:

str

CCITTFAX4

fax4 compression

Type:

str

LZW

LZW compression

Type:

str

WEBP

WEBP compression

Type:

str

ZSTD

ZSTD compression

Type:

str

JP2K

JP2K compression

Type:

str

class pyvips.enums.ForeignTiffPredictor[source]

ForeignTiffPredictor.

The predictor can help deflate and lzw compression. The values are fixed by the tiff library.

NONE

no prediction

Type:

str

HORIZONTAL

horizontal differencing

Type:

str

FLOAT

float predictor

Type:

str

class pyvips.enums.ForeignTiffResunit[source]

ForeignTiffResunit.

Use inches or centimeters as the resolution unit for a tiff file.

CM

use centimeters

Type:

str

INCH

use inches

Type:

str

class pyvips.enums.ForeignHeifCompression[source]

ForeignHeifCompression.

The compression format to use inside a HEIF container.

This is assumed to use the same numbering as heif_compression_format.

HEVC

x265

Type:

str

AVC

x264

Type:

str

JPEG

jpeg

Type:

str

AV1

aom

Type:

str

class pyvips.enums.ForeignHeifEncoder[source]

ForeignHeifEncoder.

The selected encoder to use. If libheif hasn’t been compiled with the selected encoder, we will fallback to the default encoder for the compression format.

AUTO

auto

Type:

str

AOM

aom

Type:

str

RAV1E

RAV1E

Type:

str

SVT

SVT-AV1

Type:

str

X265

x265

Type:

str

class pyvips.enums.Size[source]

Size.

Controls whether an operation should upsize, downsize, both up and downsize, or force a size.

::: seealso

Image.thumbnail().

BOTH

size both up and down

Type:

str

UP

only upsize

Type:

str

DOWN

only downsize

Type:

str

FORCE

force size, that is, break aspect ratio

Type:

str

class pyvips.enums.Intent[source]

Intent.

The rendering intent. enums.Intent.ABSOLUTE is best for scientific work, enums.Intent.RELATIVE is usually best for accurate communication with other imaging libraries.

PERCEPTUAL

perceptual rendering intent

Type:

str

RELATIVE

relative colorimetric rendering intent

Type:

str

SATURATION

saturation rendering intent

Type:

str

ABSOLUTE

absolute colorimetric rendering intent

Type:

str

AUTO

the rendering intent that the profile suggests

Type:

str

class pyvips.enums.Kernel[source]

Kernel.

The resampling kernels vips supports. See Image.reduce(), for example.

NEAREST

the nearest pixel to the point

Type:

str

LINEAR

convolve with a triangle filter

Type:

str

CUBIC

convolve with a cubic filter

Type:

str

MITCHELL

convolve with a Mitchell kernel

Type:

str

LANCZOS2

convolve with a two-lobe Lanczos kernel

Type:

str

LANCZOS3

convolve with a three-lobe Lanczos kernel

Type:

str

MKS2013

convolve with Magic Kernel Sharp 2013

Type:

str

MKS2021

convolve with Magic Kernel Sharp 2021

Type:

str

class pyvips.enums.PCS[source]

PCS.

Pick a Profile Connection Space for Image.icc_import() and Image.icc_export(). LAB is usually best, XYZ can be more convenient in some cases.

LAB

use CIELAB D65 as the Profile Connection Space

Type:

str

XYZ

use XYZ as the Profile Connection Space

Type:

str

class pyvips.enums.OperationMorphology[source]

OperationMorphology.

More like hit-miss, really.

::: seealso

Image.morph().

ERODE

true if all set

Type:

str

DILATE

true if one set

Type:

str

class pyvips.enums.CombineMode[source]

CombineMode.

See Image.draw_image() and so on.

Operations like Image.draw_image() need to be told how to combine images from two sources.

::: seealso

Image.join().

SET

set pixels to the new value

Type:

str

ADD

add pixels

Type:

str

class pyvips.enums.ForeignKeep[source]

ForeignKeep.

Which metadata to retain.

NONE

don’t attach metadata

Type:

int

EXIF

keep Exif metadata

Type:

int

XMP

keep XMP metadata

Type:

int

IPTC

keep IPTC metadata

Type:

int

ICC

keep ICC metadata

Type:

int

OTHER

keep other metadata (e.g. PNG comments)

Type:

int

GAINMAP

keep the gainmap metadata

Type:

int

ALL

keep all metadata

Type:

int

class pyvips.enums.ForeignPngFilter[source]

ForeignPngFilter.

http://www.w3.org/TR/PNG-Filters.html The values mirror those of png.h in libpng.

NONE

no filtering

Type:

int

SUB

difference to the left

Type:

int

UP

difference up

Type:

int

AVG

average of left and up

Type:

int

PAETH

pick best neighbor predictor automatically

Type:

int

ALL

adaptive

Type:

int