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, #VIPS_FORMAT_USHORT is <type>unsigned short</type>.
- 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 vips_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 #VIPS_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 #VIPS_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
- class pyvips.enums.DemandStyle[source]¶
DemandStyle.
See vips_image_pipelinev(). Operations can hint to the VIPS image IO system about the kind of demand geometry they prefer.
These demand styles are given below in order of increasing restrictiveness. When demanding output from a pipeline, vips_image_generate() will use the most restrictive of the styles requested by the operations in the pipeline.
#VIPS_DEMAND_STYLE_THINSTRIP — This operation would like to output strips the width of the image and a few pels high. This is option suitable for point-to-point operations, such as those in the arithmetic package.
This option is only efficient for cases where each output pel depends upon the pel in the corresponding position in the input image.
#VIPS_DEMAND_STYLE_FATSTRIP — This operation would like to output strips the width of the image and as high as possible. This option is suitable for area operations which do not violently transform coordinates, such as vips_conv().
#VIPS_DEMAND_STYLE_SMALLTILE — This is the most general demand format. Output is demanded in small (around 100x100 pel) sections. This style works reasonably efficiently, even for bizzare operations like 45 degree rotate.
#VIPS_DEMAND_STYLE_ANY — This image is not being demand-read from a disc file (even indirectly) so any demand style is OK. It’s used for things like vips_black() where the pixels are calculated.
See also: vips_image_pipelinev().
- SMALLTILE¶
demand in small (typically 64x64 pixel) tiles
- Type
str
- FATSTRIP¶
demand in fat (typically 10 pixel high) strips
- Type
str
- THINSTRIP¶
demand in thin (typically 1 pixel high) strips
- Type
str
- class pyvips.enums.OperationRelational[source]¶
OperationRelational.
See also: vips_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: vips_boolean().
- AND¶
&
- Type
str
- OR¶
- Type
str
- EOR¶
^
- Type
str
- LSHIFT¶
>>
- Type
str
- RSHIFT¶
<<
- Type
str
- class pyvips.enums.OperationMath2[source]¶
OperationMath2.
See also: vips_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: vips_complex2().
- CROSS_PHASE¶
convert to polar coordinates
- Type
str
- class pyvips.enums.OperationMath[source]¶
OperationMath.
See also: vips_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
- 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
- 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
- class pyvips.enums.OperationRound[source]¶
OperationRound.
See also: vips_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: vips_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: vips_complexget().
- REAL¶
get real component
- Type
str
- IMAG¶
get imaginary component
- Type
str
- class pyvips.enums.Combine[source]¶
Combine.
How to combine values. See vips_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 vips_tilecache() and #VipsForeign.
@VIPS_ACCESS_RANDOM means requests can come in any order.
@VIPS_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
- class pyvips.enums.Extend[source]¶
Extend.
See vips_embed(), vips_conv(), vips_affine() and so on.
When the edges of an image are extended, you can specify how you want the extension done.
#VIPS_EXTEND_BLACK — new pixels are black, ie. all bits are zero.
#VIPS_EXTEND_COPY — each new pixel takes the value of the nearest edge pixel
#VIPS_EXTEND_REPEAT — the image is tiled to fill the new area
#VIPS_EXTEND_MIRROR — the image is reflected and tiled to reduce hash edges
#VIPS_EXTEND_WHITE — new pixels are white, ie. all bits are set
#VIPS_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.
See also: vips_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 vips_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 vips_flip(), vips_join() and so on.
Operations like vips_flip() need to be told whether to flip left-right or top-bottom.
See also: vips_flip(), vips_join().
- HORIZONTAL¶
left-right
- Type
str
- VERTICAL¶
top-bottom
- Type
str
- class pyvips.enums.Align[source]¶
Align.
See vips_join() and so on.
Operations like vips_join() need to be told whether to align images on the low or high coordinate edge, or centre.
See also: vips_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 vips_smartcrop(), for example, to decide what parts of the image to keep.
#VIPS_INTERESTING_NONE and #VIPS_INTERESTING_LOW mean the same – the crop is positioned at the top or left. #VIPS_INTERESTING_HIGH positions at the bottom or right.
See also: vips_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 vips_rot() and so on.
Fixed rotate angles.
See also: vips_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 vips_rot45() and so on.
Fixed rotate angles.
See also: vips_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.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 #VIPS_FAIL_ON_ERROR implies #VIPS_FAIL_ON_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.ForeignPpmFormat[source]¶
ForeignPpmFormat.
The netpbm file format to save as.
#VIPS_FOREIGN_PPM_FORMAT_PBM images are single bit.
#VIPS_FOREIGN_PPM_FORMAT_PGM images are 8, 16, or 32-bits, one band.
#VIPS_FOREIGN_PPM_FORMAT_PPM images are 8, 16, or 32-bits, three bands.
#VIPS_FOREIGN_PPM_FORMAT_PFM images are 32-bit float pixels.
- PBM¶
portable bitmap
- Type
str
- PGM¶
portable greymap
- Type
str
- PPM¶
portable pixmap
- Type
str
- PFM¶
portable float map
- 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.
How many pyramid layers to create.
- 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.
- 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.Size[source]¶
Size.
Controls whether an operation should upsize, downsize, both up and downsize, or force a size.
See also: vips_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. #VIPS_INTENT_ABSOLUTE is best for scientific work, #VIPS_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
- class pyvips.enums.Kernel[source]¶
Kernel.
The resampling kernels vips supports. See vips_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
- class pyvips.enums.PCS[source]¶
PCS.
Pick a Profile Connection Space for vips_icc_import() and vips_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.
See also: vips_morph().
- ERODE¶
true if all set
- Type
str
- DILATE¶
true if one set
- Type
str
- class pyvips.enums.CombineMode[source]¶
CombineMode.
See vips_draw_image() and so on.
Operations like vips_draw_image() need to be told how to combine images from two sources.
See also: vips_join().
- SET¶
set pixels to the new value
- Type
str
- ADD¶
add pixels
- Type
str
- class pyvips.enums.Saveable[source]¶
Saveable.
See also: #VipsForeignSave.
- MONO¶
1 band (eg. CSV)
- Type
str
- RGB¶
1 or 3 bands (eg. PPM)
- Type
str
- RGBA¶
1, 2, 3 or 4 bands (eg. PNG)
- Type
str
- RGBA_ONLY¶
3 or 4 bands (eg. WEBP)
- Type
str
- RGB_CMYK¶
1, 3 or 4 bands (eg. JPEG)
- Type
str
- ANY¶
any number of bands (eg. TIFF)
- Type
str