Image
¶
Main methods¶
-
class
pyvips.
Image
(pointer)[source]¶ Wrap a VipsImage object.
-
static
new_from_file
(vips_filename, **kwargs)[source]¶ Load an image from a file.
This method can load images in any format supported by vips. The filename can include load options, for example:
image = pyvips.Image.new_from_file('fred.jpg[shrink=2]')
You can also supply options as keyword arguments, for example:
image = pyvips.Image.new_from_file('fred.jpg', shrink=2)
The full set of options available depend upon the load operation that will be executed. Try something like:
$ vips jpegload
at the command-line to see a summary of the available options for the JPEG loader.
Loading is fast: only enough of the image is loaded to be able to fill out the header. Pixels will only be decompressed when they are needed.
Parameters: vips_filename (str) – The disc file to load the image from, with optional appended arguments. All loaders support at least the following options:
Keyword Arguments: - memory (bool) – If set True, load the image via memory rather than
via a temporary disc file. See
temp_image_file()
for notes on where temporary files are created. Small images are loaded via memory by default, useVIPS_DISC_THRESHOLD
to set the definition of small. - access (Access) – Hint the expected access pattern for the image.
- fail (bool) – If set True, the loader will fail with an error on the first serious error in the file. By default, libvips will attempt to read everything it can from a damanged image.
Returns: A new
Image
.Raises: - memory (bool) – If set True, load the image via memory rather than
via a temporary disc file. See
-
static
new_from_buffer
(data, options, **kwargs)[source]¶ Load a formatted image from memory.
This behaves exactly as
new_from_file()
, but the image is loaded from the memory object rather than from a file. The memory object can be a string or buffer.Parameters: - data (str, buffer) – The memory object to load the image from.
- options (str) – Load options as a string. Use
""
for no options.
All loaders support at least the following options:
Keyword Arguments: - access (Access) – Hint the expected access pattern for the image.
- fail (bool) – If set True, the loader will fail with an error on the first serious error in the image. By default, libvips will attempt to read everything it can from a damanged image.
Returns: A new
Image
.Raises:
-
static
new_from_array
(array, scale=1.0, offset=0.0)[source]¶ Create an image from a 1D or 2D array.
A new one-band image with
BandFormat
'double'
pixels is created from the array. These image are useful with the libvips convolution operatorImage.conv()
.Parameters: - array (list[list[float]]) – Create the image from these values. 1D arrays become a single row of pixels.
- scale (float) – Default to 1.0. What to divide each pixel by after convolution. Useful for integer convolution masks.
- offset (float) – Default to 0.0. What to subtract from each pixel after convolution. Useful for integer convolution masks.
Returns: A new
Image
.Raises:
-
static
new_from_memory
(data, width, height, bands, format)[source]¶ Wrap an image around a memory array.
Wraps an Image around an area of memory containing a C-style array. For example, if the
data
memory array contains four bytes with the values 1, 2, 3, 4, you can make a one-band, 2x2 uchar image from it like this:image = Image.new_from_memory(data, 2, 2, 1, 'uchar')
A reference is kept to the data object, so it will not be garbage-collected until the returned image is garbage-collected.
This method is useful for efficiently transferring images from PIL or NumPy into libvips.
See
write_to_memory()
for the opposite operation.Use
copy()
to set other image attributes.Parameters: - data (bytes) – A memoryview or buffer object.
- width (int) – Image width in pixels.
- height (int) – Image height in pixels.
- format (BandFormat) – Band format.
Returns: A new
Image
.Raises:
-
static
new_temp_file
(format)[source]¶ Make a new temporary image.
Returns an image backed by a temporary file. When written to with
Image.write()
, a temporary file will be created on disc in the specified format. When the image is closed, the file will be deleted automatically.The file is created in the temporary directory. This is set with the environment variable
TMPDIR
. If this is not set, then on Unix systems, vips will default to/tmp
. On Windows, vips usesGetTempPath()
to find the temporary directory.vips uses
g_mkstemp()
to make the temporary filename. They generally look something like"vips-12-EJKJFGH.v"
.Parameters: format (str) – The format for the temp file, for example "%s.v"
for a vips format file. The%s
is substituted by the file path.Returns: A new Image
.Raises: Error
-
new_from_image
(value)[source]¶ Make a new image from an existing one.
A new image is created which has the same size, format, interpretation and resolution as
self
, but with every pixel set tovalue
.Parameters: value (float, list[float]) – The value for the pixels. Use a single number to make a one-band image; use an array constant to make a many-band image. Returns: A new Image
.Raises: Error
-
copy_memory
()[source]¶ Copy an image to memory.
A large area of memory is allocated, the image is rendered to that memory area, and a new image is returned which wraps that large memory area.
Returns: A new Image
.Raises: Error
-
write_to_file
(vips_filename, **kwargs)[source]¶ Write an image to a file on disc.
This method can save images in any format supported by vips. The format is selected from the filename suffix. The filename can include embedded save options, see
Image.new_from_file()
.For example:
image.write_to_file('fred.jpg[Q=95]')
You can also supply options as keyword arguments, for example:
image.write_to_file('fred.jpg', Q=95)
The full set of options available depend upon the load operation that will be executed. Try something like:
$ vips jpegsave
at the command-line to see a summary of the available options for the JPEG saver.
Parameters: vips_filename (str) – The disc file to save the image to, with optional appended arguments. Other arguments depend upon the save operation.
Returns: None Raises: Error
-
write_to_buffer
(format_string, **kwargs)[source]¶ Write an image to memory.
This method can save images in any format supported by vips. The format is selected from the suffix in the format string. This can include embedded save options, see
Image.new_from_file()
.For example:
data = image.write_to_buffer('.jpg[Q=95]')
You can also supply options as keyword arguments, for example:
data = image.write_to_buffer('.jpg', Q=95)
The full set of options available depend upon the load operation that will be executed. Try something like:
$ vips jpegsave_buffer
at the command-line to see a summary of the available options for the JPEG saver.
Parameters: format_string (str) – The suffix, plus any string-form arguments. Other arguments depend upon the save operation.
Returns: A byte string. Raises: Error
-
write_to_memory
()[source]¶ Write the image to a large memory array.
A large area of memory is allocated, the image is rendered to that memory array, and the array is returned as a buffer.
For example, if you have a 2x2 uchar image containing the bytes 1, 2, 3, 4, read left-to-right, top-to-bottom, then:
buf = image.write_to_memory()
will return a four byte buffer containing the values 1, 2, 3, 4.
Returns: buffer Raises: Error
-
write
(other)[source]¶ Write an image to another image.
This function writes
self
to another image. Use something likeImage.new_temp_file()
to make an image that can be written to.Parameters: other (Image) – The Image
to write to,Returns: None Raises: Error
-
get_typeof
(name)[source]¶ Get the GType of an item of metadata.
Fetch the GType of a piece of metadata, or 0 if the named item does not exist. See
GValue
.Parameters: name (str) – The name of the piece of metadata to get the type of. Returns: The GType
, or 0.Raises: None
-
get
(name)[source]¶ Get an item of metadata.
Fetches an item of metadata as a Python value. For example:
orientation = image.get('orientation')
would fetch the image orientation.
Parameters: name (str) – The name of the piece of metadata to get. Returns: The metadata item as a Python value. Raises: Error
-
set_type
(gtype, name, value)[source]¶ Set the type and value of an item of metadata.
Sets the type and value of an item of metadata. Any old item of the same name is removed. See
GValue
for types.Parameters: - gtype (int) – The GType of the metadata item to create.
- name (str) – The name of the piece of metadata to create.
- value (mixed) – The value to set as a Python value. It is
converted to the
gtype
, if possible.
Returns: None
Raises: None
-
set
(name, value)[source]¶ Set the value of an item of metadata.
Sets the value of an item of metadata. The metadata item must already exist.
Parameters: - name (str) – The name of the piece of metadata to set the value of.
- value (mixed) – The value to set as a Python value. It is converted to the type of the metadata item, if possible.
Returns: None
Raises: None
-
remove
(name)[source]¶ Remove an item of metadata.
The named metadata item is removed.
Parameters: name (str) – The name of the piece of metadata to remove. Returns: None Raises: None
-
__getattr__
(name)[source]¶ Divert unknown names to libvips.
Unknown attributes are first looked up in the image properties as accessors, for example:
width = image.width
and then in the libvips operation table, where they become method calls, for example:
new_image = image.invert()
Use
get()
to fetch image metadata.A
__getattr__
on the metatype lets you call static members in the same way.Parameters: name (str) – The name of the piece of metadata to get. Returns: Mixed. Raises: Error
-
get_value
(name)¶ Get an item of metadata.
Fetches an item of metadata as a Python value. For example:
orientation = image.get('orientation')
would fetch the image orientation.
Parameters: name (str) – The name of the piece of metadata to get. Returns: The metadata item as a Python value. Raises: Error
-
set_value
(name, value)¶ Set the value of an item of metadata.
Sets the value of an item of metadata. The metadata item must already exist.
Parameters: - name (str) – The name of the piece of metadata to set the value of.
- value (mixed) – The value to set as a Python value. It is converted to the type of the metadata item, if possible.
Returns: None
Raises: None
-
__getitem__
(arg)[source]¶ Overload []
Use [] to pull out band elements from an image. You can use all the usual slicing syntax, for example:
green = rgb_image[1]
Will make a new one-band image from band 1 (the middle band). You can also write:
last_two = rgb_image[1:] last_band = rgb_image[-1] middle_few = multiband[1:-2]
-
__call__
(x, y)[source]¶ Fetch a pixel value.
Parameters: - x (int) – The x coordinate to fetch.
- y (int) – The y coordinate to fetch.
Returns: Pixel as an array of floating point numbers.
Raises:
-
static
Autogenerated methods¶
-
class
pyvips.
Image
-
static
system
(cmd_format, in = list[Image], out_format = str, in_format = str)¶ Run an external command.
- Example:
- = pyvips.Image.system(cmd_format, in = list[Image], out_format = str, in_format = str)
Parameters: - cmd_format (str) – Command to run
- in (list[Image]) – Array of input images
- out_format (str) – Format for output filename
- in_format (str) – Format for input filename
Return type: list[Image, str]
Raises: Error –
-
add
(right)¶ Add two images.
- Example:
- out = left.add(right)
Parameters: right (Image) – Right-hand image argument Return type: Image Raises: Error –
-
subtract
(right)¶ Subtract two images.
- Example:
- out = left.subtract(right)
Parameters: right (Image) – Right-hand image argument Return type: Image Raises: Error –
-
multiply
(right)¶ Multiply two images.
- Example:
- out = left.multiply(right)
Parameters: right (Image) – Right-hand image argument Return type: Image Raises: Error –
-
divide
(right)¶ Divide two images.
- Example:
- out = left.divide(right)
Parameters: right (Image) – Right-hand image argument Return type: Image Raises: Error –
-
relational
(right, relational)¶ Relational operation on two images.
- Example:
- out = left.relational(right, relational)
Parameters: - right (Image) – Right-hand image argument
- relational (str) – relational to perform
Return type: Raises: Error –
-
remainder
(right)¶ Remainder after integer division of two images.
- Example:
- out = left.remainder(right)
Parameters: right (Image) – Right-hand image argument Return type: Image Raises: Error –
-
boolean
(right, boolean)¶ Boolean operation on two images.
- Example:
- out = left.boolean(right, boolean)
Parameters: - right (Image) – Right-hand image argument
- boolean (str) – boolean to perform
Return type: Raises: Error –
-
math2
(right, math2)¶ Binary math operations.
- Example:
- out = left.math2(right, math2)
Parameters: - right (Image) – Right-hand image argument
- math2 (str) – math to perform
Return type: Raises: Error –
-
complex2
(right, cmplx)¶ Complex binary operations on two images.
- Example:
- out = left.complex2(right, cmplx)
Parameters: - right (Image) – Right-hand image argument
- cmplx (str) – binary complex operation to perform
Return type: Raises: Error –
-
complexform
(right)¶ Form a complex image from two real images.
- Example:
- out = left.complexform(right)
Parameters: right (Image) – Right-hand image argument Return type: Image Raises: Error –
-
static
sum
(in)¶ Sum an array of images.
- Example:
- out = pyvips.Image.sum(in)
Parameters: in (list[Image]) – Array of input images Return type: Image Raises: Error –
-
linear
(a, b, uchar = bool)¶ Calculate (a * in + b).
- Example:
- out = in.linear(a, b, uchar = bool)
Parameters: - a (list[float]) – Multiply by this
- b (list[float]) – Add this
- uchar (bool) – Output should be uchar
Return type: Raises: Error –
-
math
(math)¶ Apply a math operation to an image.
- Example:
- out = in.math(math)
Parameters: math (str) – math to perform Return type: Image Raises: Error –
-
round
(round)¶ Perform a round function on an image.
- Example:
- out = in.round(round)
Parameters: round (str) – rounding operation to perform Return type: Image Raises: Error –
-
relational_const
(relational, c)¶ Relational operations against a constant.
- Example:
- out = in.relational_const(relational, c)
Parameters: - relational (str) – relational to perform
- c (list[float]) – Array of constants
Return type: Raises: Error –
-
remainder_const
(c)¶ Remainder after integer division of an image and a constant.
- Example:
- out = in.remainder_const(c)
Parameters: c (list[float]) – Array of constants Return type: Image Raises: Error –
-
boolean_const
(boolean, c)¶ Boolean operations against a constant.
- Example:
- out = in.boolean_const(boolean, c)
Parameters: - boolean (str) – boolean to perform
- c (list[float]) – Array of constants
Return type: Raises: Error –
-
math2_const
(math2, c)¶ Binary math operations with a constant.
- Example:
- out = in.math2_const(math2, c)
Parameters: - math2 (str) – math to perform
- c (list[float]) – Array of constants
Return type: Raises: Error –
-
complex
(cmplx)¶ Perform a complex operation on an image.
- Example:
- out = in.complex(cmplx)
Parameters: cmplx (str) – complex to perform Return type: Image Raises: Error –
-
complexget
(get)¶ Get a component from a complex image.
- Example:
- out = in.complexget(get)
Parameters: get (str) – complex to perform Return type: Image Raises: Error –
-
min
(size = int)¶ Find image minimum.
- Example:
- out = in.min(size = int)
Parameters: size (int) – Number of minimum values to find Return type: list[float, int, int, list[float], list[int], list[int]] Raises: Error –
-
max
(size = int)¶ Find image maximum.
- Example:
- out = in.max(size = int)
Parameters: size (int) – Number of maximum values to find Return type: list[float, int, int, list[float], list[int], list[int]] Raises: Error –
-
deviate
()¶ Find image standard deviation.
- Example:
- out = in.deviate()
Return type: float Raises: Error –
-
hist_find
(band = int)¶ Find image histogram.
- Example:
- out = in.hist_find(band = int)
Parameters: band (int) – Find histogram of band Return type: Image Raises: Error –
-
hist_find_ndim
(bins = int)¶ Find n-dimensional image histogram.
- Example:
- out = in.hist_find_ndim(bins = int)
Parameters: bins (int) – Number of bins in each dimension Return type: Image Raises: Error –
-
hist_find_indexed
(index)¶ Find indexed image histogram.
- Example:
- out = in.hist_find_indexed(index)
Parameters: index (Image) – Index image Return type: Image Raises: Error –
-
hough_line
(width = int, height = int)¶ Find hough line transform.
- Example:
- out = in.hough_line(width = int, height = int)
Parameters: - width (int) – horizontal size of parameter space
- height (int) – Vertical size of parameter space
Return type: Raises: Error –
-
hough_circle
(scale = int, min_radius = int, max_radius = int)¶ Find hough circle transform.
- Example:
- out = in.hough_circle(scale = int, min_radius = int, max_radius = int)
Parameters: - scale (int) – Scale down dimensions by this factor
- min_radius (int) – Smallest radius to search for
- max_radius (int) – Largest radius to search for
Return type: Raises: Error –
-
project
()¶ Find image projections.
- Example:
- columns, rows = in.project()
Return type: list[Image, Image] Raises: Error –
-
profile
()¶ Find image profiles.
- Example:
- columns, rows = in.profile()
Return type: list[Image, Image] Raises: Error –
-
measure
(h, v, left = int, top = int, width = int, height = int)¶ Measure a set of patches on a color chart.
- Example:
- out = in.measure(h, v, left = int, top = int, width = int, height = int)
Parameters: - h (int) – Number of patches across chart
- v (int) – Number of patches down chart
- left (int) – Left edge of extract area
- top (int) – Top edge of extract area
- width (int) – Width of extract area
- height (int) – Height of extract area
Return type: Raises: Error –
-
getpoint
(x, y)¶ Read a point from an image.
- Example:
- out_array = in.getpoint(x, y)
Parameters: - x (int) – Point to read
- y (int) – Point to read
Return type: list[float]
Raises: Error –
-
copy
(width = int, height = int, bands = int, format = str, coding = str, interpretation = str, xres = float, yres = float, xoffset = int, yoffset = int)¶ Copy an image.
- Example:
- out = in.copy(width = int, height = int, bands = int, format = str, coding = str, interpretation = str, xres = float, yres = float, xoffset = int, yoffset = int)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- bands (int) – Number of bands in image
- format (str) – Pixel format in image
- coding (str) – Pixel coding
- interpretation (str) – Pixel interpretation
- xres (float) – Horizontal resolution in pixels/mm
- yres (float) – Vertical resolution in pixels/mm
- xoffset (int) – Horizontal offset of origin
- yoffset (int) – Vertical offset of origin
Return type: Raises: Error –
-
tilecache
(tile_width = int, tile_height = int, max_tiles = int, access = str, threaded = bool, persistent = bool)¶ Cache an image as a set of tiles.
- Example:
- out = in.tilecache(tile_width = int, tile_height = int, max_tiles = int, access = str, threaded = bool, persistent = bool)
Parameters: - tile_width (int) – Tile width in pixels
- tile_height (int) – Tile height in pixels
- max_tiles (int) – Maximum number of tiles to cache
- access (str) – Expected access pattern
- threaded (bool) – Allow threaded access
- persistent (bool) – Keep cache between evaluations
Return type: Raises: Error –
-
linecache
(tile_height = int, access = str, threaded = bool, persistent = bool)¶ Cache an image as a set of lines.
- Example:
- out = in.linecache(tile_height = int, access = str, threaded = bool, persistent = bool)
Parameters: - tile_height (int) – Tile height in pixels
- access (str) – Expected access pattern
- threaded (bool) – Allow threaded access
- persistent (bool) – Keep cache between evaluations
Return type: Raises: Error –
-
sequential
(tile_height = int)¶ Check sequential access.
- Example:
- out = in.sequential(tile_height = int)
Parameters: tile_height (int) – Tile height in pixels Return type: Image Raises: Error –
-
cache
(max_tiles = int, tile_height = int, tile_width = int)¶ Cache an image.
- Example:
- out = in.cache(max_tiles = int, tile_height = int, tile_width = int)
Parameters: - max_tiles (int) – Maximum number of tiles to cache
- tile_height (int) – Tile height in pixels
- tile_width (int) – Tile width in pixels
Return type: Raises: Error –
-
embed
(x, y, width, height, extend = str, background = list[float])¶ Embed an image in a larger image.
- Example:
- out = in.embed(x, y, width, height, extend = str, background = list[float])
Parameters: - x (int) – Left edge of input in output
- y (int) – Top edge of input in output
- width (int) – Image width in pixels
- height (int) – Image height in pixels
- extend (str) – How to generate the extra pixels
- background (list[float]) – Color for background pixels
Return type: Raises: Error –
-
flip
(direction)¶ Flip an image.
- Example:
- out = in.flip(direction)
Parameters: direction (str) – Direction to flip image Return type: Image Raises: Error –
-
insert
(sub, x, y, expand = bool, background = list[float])¶ Insert image @sub into @main at @x, @y.
- Example:
- out = main.insert(sub, x, y, expand = bool, background = list[float])
Parameters: - sub (Image) – Sub-image to insert into main image
- x (int) – Left edge of sub in main
- y (int) – Top edge of sub in main
- expand (bool) – Expand output to hold all of both inputs
- background (list[float]) – Color for new pixels
Return type: Raises: Error –
-
join
(in2, direction, expand = bool, shim = int, background = list[float], align = str)¶ Join a pair of images.
- Example:
- out = in1.join(in2, direction, expand = bool, shim = int, background = list[float], align = str)
Parameters: - in2 (Image) – Second input image
- direction (str) – Join left-right or up-down
- expand (bool) – Expand output to hold all of both inputs
- shim (int) – Pixels between images
- background (list[float]) – Colour for new pixels
- align (str) – Align on the low, centre or high coordinate edge
Return type: Raises: Error –
-
static
arrayjoin
(in, across = int, shim = int, background = list[float], halign = str, valign = str, hspacing = int, vspacing = int)¶ Join an array of images.
- Example:
- out = pyvips.Image.arrayjoin(in, across = int, shim = int, background = list[float], halign = str, valign = str, hspacing = int, vspacing = int)
Parameters: - in (list[Image]) – Array of input images
- across (int) – Number of images across grid
- shim (int) – Pixels between images
- background (list[float]) – Colour for new pixels
- halign (str) – Align on the left, centre or right
- valign (str) – Align on the top, centre or bottom
- hspacing (int) – Horizontal spacing between images
- vspacing (int) – Vertical spacing between images
Return type: Raises: Error –
-
extract_area
(left, top, width, height)¶ Extract an area from an image.
- Example:
- out = input.extract_area(left, top, width, height)
Parameters: - left (int) – Left edge of extract area
- top (int) – Top edge of extract area
- width (int) – Width of extract area
- height (int) – Height of extract area
Return type: Raises: Error –
-
extract_area
(left, top, width, height) Extract an area from an image.
- Example:
- out = input.extract_area(left, top, width, height)
Parameters: - left (int) – Left edge of extract area
- top (int) – Top edge of extract area
- width (int) – Width of extract area
- height (int) – Height of extract area
Return type: Raises: Error –
-
smartcrop
(width, height, interesting = str)¶ Extract an area from an image.
- Example:
- out = input.smartcrop(width, height, interesting = str)
Parameters: - width (int) – Width of extract area
- height (int) – Height of extract area
- interesting (str) – How to measure interestingness
Return type: Raises: Error –
-
extract_band
(band, n = int)¶ Extract band from an image.
- Example:
- out = in.extract_band(band, n = int)
Parameters: - band (int) – Band to extract
- n (int) – Number of bands to extract
Return type: Raises: Error –
-
static
bandjoin
(in) Bandwise join a set of images.
- Example:
- out = pyvips.Image.bandjoin(in)
Parameters: in (list[Image]) – Array of input images Return type: Image Raises: Error –
-
bandjoin_const
(c)¶ Append a constant band to an image.
- Example:
- out = in.bandjoin_const(c)
Parameters: c (list[float]) – Array of constants to add Return type: Image Raises: Error –
-
static
bandrank
(in, index = int) Band-wise rank of a set of images.
- Example:
- out = pyvips.Image.bandrank(in, index = int)
Parameters: - in (list[Image]) – Array of input images
- index (int) – Select this band element from sorted list
Return type: Raises: Error –
-
bandbool
(boolean)¶ Boolean operation across image bands.
- Example:
- out = in.bandbool(boolean)
Parameters: boolean (str) – boolean to perform Return type: Image Raises: Error –
-
replicate
(across, down)¶ Replicate an image.
- Example:
- out = in.replicate(across, down)
Parameters: - across (int) – Repeat this many times horizontally
- down (int) – Repeat this many times vertically
Return type: Raises: Error –
-
cast
(format, shift = bool)¶ Cast an image.
- Example:
- out = in.cast(format, shift = bool)
Parameters: - format (str) – Format to cast to
- shift (bool) – Shift integer values up and down
Return type: Raises: Error –
-
rot
(angle)¶ Rotate an image.
- Example:
- out = in.rot(angle)
Parameters: angle (str) – Angle to rotate image Return type: Image Raises: Error –
-
rot45
(angle = str)¶ Rotate an image.
- Example:
- out = in.rot45(angle = str)
Parameters: angle (str) – Angle to rotate image Return type: Image Raises: Error –
-
autorot
()¶ Autorotate image by exif tag.
- Example:
- out = in.autorot()
Return type: list[Image, str] Raises: Error –
-
ifthenelse
(in1, in2, blend = bool) Ifthenelse an image.
- Example:
- out = cond.ifthenelse(in1, in2, blend = bool)
Parameters: Return type: Raises: Error –
-
recomb
(m)¶ Linear recombination with matrix.
- Example:
- out = in.recomb(m)
Parameters: m (Image) – matrix of coefficients Return type: Image Raises: Error –
-
bandfold
(factor = int)¶ Fold up x axis into bands.
- Example:
- out = in.bandfold(factor = int)
Parameters: factor (int) – Fold by this factor Return type: Image Raises: Error –
-
bandunfold
(factor = int)¶ Unfold image bands into x axis.
- Example:
- out = in.bandunfold(factor = int)
Parameters: factor (int) – Unfold by this factor Return type: Image Raises: Error –
-
flatten
(background = list[float], max_alpha = float)¶ Flatten alpha out of an image.
- Example:
- out = in.flatten(background = list[float], max_alpha = float)
Parameters: - background (list[float]) – Background value
- max_alpha (float) – Maximum value of alpha channel
Return type: Raises: Error –
-
premultiply
(max_alpha = float)¶ Premultiply image alpha.
- Example:
- out = in.premultiply(max_alpha = float)
Parameters: max_alpha (float) – Maximum value of alpha channel Return type: Image Raises: Error –
-
unpremultiply
(max_alpha = float)¶ Unpremultiply image alpha.
- Example:
- out = in.unpremultiply(max_alpha = float)
Parameters: max_alpha (float) – Maximum value of alpha channel Return type: Image Raises: Error –
-
grid
(tile_height, across, down)¶ Grid an image.
- Example:
- out = in.grid(tile_height, across, down)
Parameters: - tile_height (int) – chop into tiles this high
- across (int) – number of tiles across
- down (int) – number of tiles down
Return type: Raises: Error –
-
scale
(exp = float, log = bool)¶ Scale an image to uchar.
- Example:
- out = in.scale(exp = float, log = bool)
Parameters: - exp (float) – Exponent for log scale
- log (bool) – Log scale
Return type: Raises: Error –
-
wrap
(x = int, y = int)¶ Wrap image origin.
- Example:
- out = in.wrap(x = int, y = int)
Parameters: - x (int) – Left edge of input in output
- y (int) – Top edge of input in output
Return type: Raises: Error –
-
zoom
(xfac, yfac)¶ Zoom an image.
- Example:
- out = input.zoom(xfac, yfac)
Parameters: - xfac (int) – Horizontal zoom factor
- yfac (int) – Vertical zoom factor
Return type: Raises: Error –
-
subsample
(xfac, yfac, point = bool)¶ Subsample an image.
- Example:
- out = input.subsample(xfac, yfac, point = bool)
Parameters: - xfac (int) – Horizontal subsample factor
- yfac (int) – Vertical subsample factor
- point (bool) – Point sample
Return type: Raises: Error –
-
msb
(band = int)¶ Pick most-significant byte from an image.
- Example:
- out = in.msb(band = int)
Parameters: band (int) – Band to msb Return type: Image Raises: Error –
-
falsecolour
()¶ False-color an image.
- Example:
- out = in.falsecolour()
Return type: Image Raises: Error –
-
gamma
(exponent = float)¶ Gamma an image.
- Example:
- out = in.gamma(exponent = float)
Parameters: exponent (float) – Gamma factor Return type: Image Raises: Error –
-
static
black
(width, height, bands = int)¶ Make a black image.
- Example:
- out = pyvips.Image.black(width, height, bands = int)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- bands (int) – Number of bands in image
Return type: Raises: Error –
-
static
gaussnoise
(width, height, sigma = float, mean = float)¶ Make a gaussnoise image.
- Example:
- out = pyvips.Image.gaussnoise(width, height, sigma = float, mean = float)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- sigma (float) – Standard deviation of pixels in generated image
- mean (float) – Mean of pixels in generated image
Return type: Raises: Error –
-
static
text
(text, font = str, width = int, align = str, dpi = int, spacing = int)¶ Make a text image.
- Example:
- out = pyvips.Image.text(text, font = str, width = int, align = str, dpi = int, spacing = int)
Parameters: - text (str) – Text to render
- font (str) – Font to render with
- width (int) – Maximum image width in pixels
- align (str) – Align on the low, centre or high edge
- dpi (int) – DPI to render at
- spacing (int) – Line spacing
Return type: Raises: Error –
-
static
xyz
(width, height, csize = int, dsize = int, esize = int)¶ Make an image where pixel values are coordinates.
- Example:
- out = pyvips.Image.xyz(width, height, csize = int, dsize = int, esize = int)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- csize (int) – Size of third dimension
- dsize (int) – Size of fourth dimension
- esize (int) – Size of fifth dimension
Return type: Raises: Error –
-
static
gaussmat
(sigma, min_ampl, separable = bool, precision = str)¶ Make a gaussian image.
- Example:
- out = pyvips.Image.gaussmat(sigma, min_ampl, separable = bool, precision = str)
Parameters: - sigma (float) – Sigma of Gaussian
- min_ampl (float) – Minimum amplitude of Gaussian
- separable (bool) – Generate separable Gaussian
- precision (str) – Generate with this precision
Return type: Raises: Error –
-
static
logmat
(sigma, min_ampl, separable = bool, precision = str)¶ Make a laplacian of gaussian image.
- Example:
- out = pyvips.Image.logmat(sigma, min_ampl, separable = bool, precision = str)
Parameters: - sigma (float) – Radius of Logmatian
- min_ampl (float) – Minimum amplitude of Logmatian
- separable (bool) – Generate separable Logmatian
- precision (str) – Generate with this precision
Return type: Raises: Error –
-
static
eye
(width, height, uchar = bool, factor = float)¶ Make an image showing the eye’s spatial response.
- Example:
- out = pyvips.Image.eye(width, height, uchar = bool, factor = float)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- uchar (bool) – Output an unsigned char image
- factor (float) – Maximum spatial frequency
Return type: Raises: Error –
-
static
grey
(width, height, uchar = bool)¶ Make a grey ramp image.
- Example:
- out = pyvips.Image.grey(width, height, uchar = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- uchar (bool) – Output an unsigned char image
Return type: Raises: Error –
-
static
zone
(width, height, uchar = bool)¶ Make a zone plate.
- Example:
- out = pyvips.Image.zone(width, height, uchar = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- uchar (bool) – Output an unsigned char image
Return type: Raises: Error –
-
static
sines
(width, height, uchar = bool, hfreq = float, vfreq = float)¶ Make a 2D sine wave.
- Example:
- out = pyvips.Image.sines(width, height, uchar = bool, hfreq = float, vfreq = float)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- uchar (bool) – Output an unsigned char image
- hfreq (float) – Horizontal spatial frequency
- vfreq (float) – Vertical spatial frequency
Return type: Raises: Error –
-
static
mask_ideal
(width, height, frequency_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make an ideal filter.
- Example:
- out = pyvips.Image.mask_ideal(width, height, frequency_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- frequency_cutoff (float) – Frequency cutoff
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_ideal_ring
(width, height, frequency_cutoff, ringwidth, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make an ideal ring filter.
- Example:
- out = pyvips.Image.mask_ideal_ring(width, height, frequency_cutoff, ringwidth, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- frequency_cutoff (float) – Frequency cutoff
- ringwidth (float) – Ringwidth
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_ideal_band
(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make an ideal band filter.
- Example:
- out = pyvips.Image.mask_ideal_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- frequency_cutoff_x (float) – Frequency cutoff x
- frequency_cutoff_y (float) – Frequency cutoff y
- radius (float) – radius of circle
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_butterworth
(width, height, order, frequency_cutoff, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make a butterworth filter.
- Example:
- out = pyvips.Image.mask_butterworth(width, height, order, frequency_cutoff, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- order (float) – Filter order
- frequency_cutoff (float) – Frequency cutoff
- amplitude_cutoff (float) – Amplitude cutoff
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_butterworth_ring
(width, height, order, frequency_cutoff, amplitude_cutoff, ringwidth, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make a butterworth ring filter.
- Example:
- out = pyvips.Image.mask_butterworth_ring(width, height, order, frequency_cutoff, amplitude_cutoff, ringwidth, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- order (float) – Filter order
- frequency_cutoff (float) – Frequency cutoff
- amplitude_cutoff (float) – Amplitude cutoff
- ringwidth (float) – Ringwidth
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_butterworth_band
(width, height, order, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make a butterworth_band filter.
- Example:
- out = pyvips.Image.mask_butterworth_band(width, height, order, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- order (float) – Filter order
- frequency_cutoff_x (float) – Frequency cutoff x
- frequency_cutoff_y (float) – Frequency cutoff y
- radius (float) – radius of circle
- amplitude_cutoff (float) – Amplitude cutoff
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_gaussian
(width, height, frequency_cutoff, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make a gaussian filter.
- Example:
- out = pyvips.Image.mask_gaussian(width, height, frequency_cutoff, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- frequency_cutoff (float) – Frequency cutoff
- amplitude_cutoff (float) – Amplitude cutoff
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_gaussian_ring
(width, height, frequency_cutoff, amplitude_cutoff, ringwidth, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make a gaussian ring filter.
- Example:
- out = pyvips.Image.mask_gaussian_ring(width, height, frequency_cutoff, amplitude_cutoff, ringwidth, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- frequency_cutoff (float) – Frequency cutoff
- amplitude_cutoff (float) – Amplitude cutoff
- ringwidth (float) – Ringwidth
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_gaussian_band
(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make a gaussian filter.
- Example:
- out = pyvips.Image.mask_gaussian_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- frequency_cutoff_x (float) – Frequency cutoff x
- frequency_cutoff_y (float) – Frequency cutoff y
- radius (float) – radius of circle
- amplitude_cutoff (float) – Amplitude cutoff
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
static
mask_fractal
(width, height, fractal_dimension, uchar = bool, nodc = bool, reject = bool, optical = bool)¶ Make fractal filter.
- Example:
- out = pyvips.Image.mask_fractal(width, height, fractal_dimension, uchar = bool, nodc = bool, reject = bool, optical = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- fractal_dimension (float) – Fractal dimension
- uchar (bool) – Output an unsigned char image
- nodc (bool) – Remove DC component
- reject (bool) – Invert the sense of the filter
- optical (bool) – Rotate quadrants to optical space
Return type: Raises: Error –
-
invertlut
(size = int)¶ Build an inverted look-up table.
- Example:
- out = in.invertlut(size = int)
Parameters: size (int) – LUT size to generate Return type: Image Raises: Error –
-
static
tonelut
(in_max = int, out_max = int, Lb = float, Lw = float, Ps = float, Pm = float, Ph = float, S = float, M = float, H = float)¶ Build a look-up table.
- Example:
- out = pyvips.Image.tonelut(in_max = int, out_max = int, Lb = float, Lw = float, Ps = float, Pm = float, Ph = float, S = float, M = float, H = float)
Parameters: - in_max (int) – Size of LUT to build
- out_max (int) – Maximum value in output LUT
- Lb (float) – Lowest value in output
- Lw (float) – Highest value in output
- Ps (float) – Position of shadow
- Pm (float) – Position of mid-tones
- Ph (float) – Position of highlights
- S (float) – Adjust shadows by this much
- M (float) – Adjust mid-tones by this much
- H (float) – Adjust highlights by this much
Return type: Raises: Error –
-
static
identity
(bands = int, ushort = bool, size = int)¶ Make a 1D image where pixel values are indexes.
- Example:
- out = pyvips.Image.identity(bands = int, ushort = bool, size = int)
Parameters: - bands (int) – Number of bands in LUT
- ushort (bool) – Create a 16-bit LUT
- size (int) – Size of 16-bit LUT
Return type: Raises: Error –
-
static
fractsurf
(width, height, fractal_dimension)¶ Make a fractal surface.
- Example:
- out = pyvips.Image.fractsurf(width, height, fractal_dimension)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- fractal_dimension (float) – Fractal dimension
Return type: Raises: Error –
-
static
worley
(width, height, cell_size = int)¶ Make a worley noise image.
- Example:
- out = pyvips.Image.worley(width, height, cell_size = int)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- cell_size (int) – Size of Worley cells
Return type: Raises: Error –
-
static
perlin
(width, height, cell_size = int, uchar = bool)¶ Make a perlin noise image.
- Example:
- out = pyvips.Image.perlin(width, height, cell_size = int, uchar = bool)
Parameters: - width (int) – Image width in pixels
- height (int) – Image height in pixels
- cell_size (int) – Size of Perlin cells
- uchar (bool) – Output an unsigned char image
Return type: Raises: Error –
-
static
csvload
(filename, disc = bool, access = str, skip = int, lines = int, fail = bool, whitespace = str, separator = str)¶ Load csv from file.
- Example:
- out = pyvips.Image.csvload(filename, disc = bool, access = str, skip = int, lines = int, fail = bool, whitespace = str, separator = str)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- skip (int) – Skip this many lines at the start of the file
- lines (int) – Read this many lines from the file
- fail (bool) – Fail on first error
- whitespace (str) – Set of whitespace characters
- separator (str) – Set of separator characters
Return type: list[Image, int]
Raises: Error –
-
static
matrixload
(filename, disc = bool, access = str, fail = bool)¶ Load matrix from file.
- Example:
- out = pyvips.Image.matrixload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
rawload
(filename, width, height, bands, disc = bool, access = str, fail = bool, offset = <unknown type>)¶ Load raw data from a file.
- Example:
- out = pyvips.Image.rawload(filename, width, height, bands, disc = bool, access = str, fail = bool, offset = <unknown type>)
Parameters: - filename (str) – Filename to load from
- width (int) – Image width in pixels
- height (int) – Image height in pixels
- bands (int) – Number of bands in image
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
- type> offset (<unknown) – Offset in bytes from start of file
Return type: list[Image, int]
Raises: Error –
-
static
vipsload
(filename, disc = bool, access = str, fail = bool)¶ Load vips from file.
- Example:
- out = pyvips.Image.vipsload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
analyzeload
(filename, disc = bool, access = str, fail = bool)¶ Load an Analyze6 image.
- Example:
- out = pyvips.Image.analyzeload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
ppmload
(filename, disc = bool, access = str, fail = bool)¶ Load ppm from file.
- Example:
- out = pyvips.Image.ppmload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
radload
(filename, disc = bool, access = str, fail = bool)¶ Load a Radiance image from a file.
- Example:
- out = pyvips.Image.radload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
pdfload
(filename, disc = bool, access = str, page = int, n = int, fail = bool, dpi = float, scale = float)¶ Load PDF with libpoppler.
- Example:
- out = pyvips.Image.pdfload(filename, disc = bool, access = str, page = int, n = int, fail = bool, dpi = float, scale = float)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- page (int) – Load this page from the file
- n (int) – Load this many pages
- fail (bool) – Fail on first error
- dpi (float) – Render at this DPI
- scale (float) – Scale output by this factor
Return type: list[Image, int]
Raises: Error –
-
static
pdfload_buffer
(buffer, disc = bool, access = str, page = int, n = int, fail = bool, dpi = float, scale = float)¶ Load PDF with libpoppler.
- Example:
- out = pyvips.Image.pdfload_buffer(buffer, disc = bool, access = str, page = int, n = int, fail = bool, dpi = float, scale = float)
Parameters: - buffer (str) – Buffer to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- page (int) – Load this page from the file
- n (int) – Load this many pages
- fail (bool) – Fail on first error
- dpi (float) – Render at this DPI
- scale (float) – Scale output by this factor
Return type: list[Image, int]
Raises: Error –
-
static
svgload
(filename, disc = bool, access = str, dpi = float, fail = bool, scale = float)¶ Load SVG with rsvg.
- Example:
- out = pyvips.Image.svgload(filename, disc = bool, access = str, dpi = float, fail = bool, scale = float)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- dpi (float) – Render at this DPI
- fail (bool) – Fail on first error
- scale (float) – Scale output by this factor
Return type: list[Image, int]
Raises: Error –
-
static
svgload
(filename, disc = bool, access = str, dpi = float, fail = bool, scale = float) Load SVG with rsvg.
- Example:
- out = pyvips.Image.svgload(filename, disc = bool, access = str, dpi = float, fail = bool, scale = float)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- dpi (float) – Render at this DPI
- fail (bool) – Fail on first error
- scale (float) – Scale output by this factor
Return type: list[Image, int]
Raises: Error –
-
static
svgload_buffer
(buffer, disc = bool, access = str, dpi = float, fail = bool, scale = float)¶ Load SVG with rsvg.
- Example:
- out = pyvips.Image.svgload_buffer(buffer, disc = bool, access = str, dpi = float, fail = bool, scale = float)
Parameters: - buffer (str) – Buffer to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- dpi (float) – Render at this DPI
- fail (bool) – Fail on first error
- scale (float) – Scale output by this factor
Return type: list[Image, int]
Raises: Error –
-
static
gifload
(filename, n = int, disc = bool, access = str, page = int, fail = bool)¶ Load GIF with giflib.
- Example:
- out = pyvips.Image.gifload(filename, n = int, disc = bool, access = str, page = int, fail = bool)
Parameters: - filename (str) – Filename to load from
- n (int) – Load this many pages
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- page (int) – Load this page from the file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
gifload_buffer
(buffer, n = int, disc = bool, access = str, page = int, fail = bool)¶ Load GIF with giflib.
- Example:
- out = pyvips.Image.gifload_buffer(buffer, n = int, disc = bool, access = str, page = int, fail = bool)
Parameters: - buffer (str) – Buffer to load from
- n (int) – Load this many pages
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- page (int) – Load this page from the file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
pngload
(filename, disc = bool, access = str, fail = bool)¶ Load png from file.
- Example:
- out = pyvips.Image.pngload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
pngload_buffer
(buffer, disc = bool, access = str, fail = bool)¶ Load png from buffer.
- Example:
- out = pyvips.Image.pngload_buffer(buffer, disc = bool, access = str, fail = bool)
Parameters: - buffer (str) – Buffer to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
matload
(filename, disc = bool, access = str, fail = bool)¶ Load mat from file.
- Example:
- out = pyvips.Image.matload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
jpegload
(filename, disc = bool, access = str, shrink = int, fail = bool, autorotate = bool)¶ Load jpeg from file.
- Example:
- out = pyvips.Image.jpegload(filename, disc = bool, access = str, shrink = int, fail = bool, autorotate = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- shrink (int) – Shrink factor on load
- fail (bool) – Fail on first error
- autorotate (bool) – Rotate image using exif orientation
Return type: list[Image, int]
Raises: Error –
-
static
jpegload_buffer
(buffer, disc = bool, access = str, shrink = int, fail = bool, autorotate = bool)¶ Load jpeg from buffer.
- Example:
- out = pyvips.Image.jpegload_buffer(buffer, disc = bool, access = str, shrink = int, fail = bool, autorotate = bool)
Parameters: - buffer (str) – Buffer to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- shrink (int) – Shrink factor on load
- fail (bool) – Fail on first error
- autorotate (bool) – Rotate image using exif orientation
Return type: list[Image, int]
Raises: Error –
-
static
webpload
(filename, disc = bool, access = str, shrink = int, fail = bool)¶ Load webp from file.
- Example:
- out = pyvips.Image.webpload(filename, disc = bool, access = str, shrink = int, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- shrink (int) – Shrink factor on load
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
webpload_buffer
(buffer, disc = bool, access = str, shrink = int, fail = bool)¶ Load webp from buffer.
- Example:
- out = pyvips.Image.webpload_buffer(buffer, disc = bool, access = str, shrink = int, fail = bool)
Parameters: - buffer (str) – Buffer to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- shrink (int) – Shrink factor on load
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
tiffload
(filename, disc = bool, access = str, page = int, n = int, fail = bool, autorotate = bool)¶ Load tiff from file.
- Example:
- out = pyvips.Image.tiffload(filename, disc = bool, access = str, page = int, n = int, fail = bool, autorotate = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- page (int) – Load this page from the image
- n (int) – Load this many pages
- fail (bool) – Fail on first error
- autorotate (bool) – Rotate image using orientation tag
Return type: list[Image, int]
Raises: Error –
-
static
tiffload_buffer
(buffer, disc = bool, access = str, page = int, n = int, fail = bool, autorotate = bool)¶ Load tiff from buffer.
- Example:
- out = pyvips.Image.tiffload_buffer(buffer, disc = bool, access = str, page = int, n = int, fail = bool, autorotate = bool)
Parameters: - buffer (str) – Buffer to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- page (int) – Load this page from the image
- n (int) – Load this many pages
- fail (bool) – Fail on first error
- autorotate (bool) – Rotate image using orientation tag
Return type: list[Image, int]
Raises: Error –
-
static
openslideload
(filename, disc = bool, access = str, level = int, autocrop = bool, fail = bool, associated = str)¶ Load file with OpenSlide.
- Example:
- out = pyvips.Image.openslideload(filename, disc = bool, access = str, level = int, autocrop = bool, fail = bool, associated = str)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- level (int) – Load this level from the file
- autocrop (bool) – Crop to image bounds
- fail (bool) – Fail on first error
- associated (str) – Load this associated image
Return type: list[Image, int]
Raises: Error –
-
static
magickload
(filename, density = str, page = int, n = int, disc = bool, access = str, fail = bool)¶ Load file with ImageMagick.
- Example:
- out = pyvips.Image.magickload(filename, density = str, page = int, n = int, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- density (str) – Canvas resolution for rendering vector formats like SVG
- page (int) – Load this page from the file
- n (int) – Load this many pages
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
magickload_buffer
(buffer, density = str, page = int, n = int, disc = bool, access = str, fail = bool)¶ Load buffer with ImageMagick.
- Example:
- out = pyvips.Image.magickload_buffer(buffer, density = str, page = int, n = int, disc = bool, access = str, fail = bool)
Parameters: - buffer (str) – Buffer to load from
- density (str) – Canvas resolution for rendering vector formats like SVG
- page (int) – Load this page from the file
- n (int) – Load this many pages
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
fitsload
(filename, disc = bool, access = str, fail = bool)¶ Load a FITS image.
- Example:
- out = pyvips.Image.fitsload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
static
openexrload
(filename, disc = bool, access = str, fail = bool)¶ Load an OpenEXR image.
- Example:
- out = pyvips.Image.openexrload(filename, disc = bool, access = str, fail = bool)
Parameters: - filename (str) – Filename to load from
- disc (bool) – Open to disc
- access (str) – Required access pattern for this file
- fail (bool) – Fail on first error
Return type: list[Image, int]
Raises: Error –
-
csvsave
(filename, separator = str, strip = bool, background = list[float])¶ Save image to csv file.
- Example:
- = in.csvsave(filename, separator = str, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- separator (str) – Separator characters
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
matrixsave
(filename, strip = bool, background = list[float])¶ Save image to matrix file.
- Example:
- = in.matrixsave(filename, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
matrixprint
(strip = bool, background = list[float])¶ Print matrix.
- Example:
- = in.matrixprint(strip = bool, background = list[float])
Parameters: - strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
rawsave
(filename, strip = bool, background = list[float])¶ Save image to raw file.
- Example:
- = in.rawsave(filename, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
rawsave_fd
(fd, strip = bool, background = list[float])¶ Write raw image to file descriptor.
- Example:
- = in.rawsave_fd(fd, strip = bool, background = list[float])
Parameters: - fd (int) – File descriptor to write to
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
vipssave
(filename, strip = bool, background = list[float])¶ Save image to vips file.
- Example:
- = in.vipssave(filename, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
ppmsave
(filename, ascii = bool, squash = bool, strip = bool, background = list[float])¶ Save image to ppm file.
- Example:
- = in.ppmsave(filename, ascii = bool, squash = bool, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- ascii (bool) – save as ascii
- squash (bool) – save as one bit
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
radsave
(filename, strip = bool, background = list[float])¶ Save image to Radiance file.
- Example:
- = in.radsave(filename, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
radsave_buffer
(strip = bool, background = list[float])¶ Save image to Radiance buffer.
- Example:
- buffer = in.radsave_buffer(strip = bool, background = list[float])
Parameters: - strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: str
Raises: Error –
-
dzsave
(filename, basename = str, layout = str, suffix = str, overlap = int, tile_size = int, centre = bool, depth = str, angle = str, container = str, properties = bool, compression = int, strip = bool, background = list[float])¶ Save image to deepzoom file.
- Example:
- = in.dzsave(filename, basename = str, layout = str, suffix = str, overlap = int, tile_size = int, centre = bool, depth = str, angle = str, container = str, properties = bool, compression = int, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- basename (str) – Base name to save to
- layout (str) – Directory layout
- suffix (str) – Filename suffix for tiles
- overlap (int) – Tile overlap in pixels
- tile_size (int) – Tile size in pixels
- centre (bool) – Center image in tile
- depth (str) – Pyramid depth
- angle (str) – Rotate image during save
- container (str) – Pyramid container type
- properties (bool) – Write a properties file to the output directory
- compression (int) – ZIP deflate compression level
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
dzsave_buffer
(basename = str, layout = str, suffix = str, overlap = int, tile_size = int, centre = bool, depth = str, angle = str, container = str, properties = bool, compression = int, strip = bool, background = list[float])¶ Save image to dz buffer.
- Example:
- buffer = in.dzsave_buffer(basename = str, layout = str, suffix = str, overlap = int, tile_size = int, centre = bool, depth = str, angle = str, container = str, properties = bool, compression = int, strip = bool, background = list[float])
Parameters: - basename (str) – Base name to save to
- layout (str) – Directory layout
- suffix (str) – Filename suffix for tiles
- overlap (int) – Tile overlap in pixels
- tile_size (int) – Tile size in pixels
- centre (bool) – Center image in tile
- depth (str) – Pyramid depth
- angle (str) – Rotate image during save
- container (str) – Pyramid container type
- properties (bool) – Write a properties file to the output directory
- compression (int) – ZIP deflate compression level
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: str
Raises: Error –
-
pngsave
(filename, compression = int, interlace = bool, profile = str, filter = int, strip = bool, background = list[float])¶ Save image to png file.
- Example:
- = in.pngsave(filename, compression = int, interlace = bool, profile = str, filter = int, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- compression (int) – Compression factor
- interlace (bool) – Interlace image
- profile (str) – ICC profile to embed
- filter (int) – libpng row filter flag(s)
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
pngsave_buffer
(compression = int, interlace = bool, profile = str, filter = int, strip = bool, background = list[float])¶ Save image to png buffer.
- Example:
- buffer = in.pngsave_buffer(compression = int, interlace = bool, profile = str, filter = int, strip = bool, background = list[float])
Parameters: - compression (int) – Compression factor
- interlace (bool) – Interlace image
- profile (str) – ICC profile to embed
- filter (int) – libpng row filter flag(s)
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: str
Raises: Error –
-
jpegsave
(filename, Q = int, profile = str, optimize_coding = bool, interlace = bool, no_subsample = bool, trellis_quant = bool, overshoot_deringing = bool, optimize_scans = bool, quant_table = int, strip = bool, background = list[float])¶ Save image to jpeg file.
- Example:
- = in.jpegsave(filename, Q = int, profile = str, optimize_coding = bool, interlace = bool, no_subsample = bool, trellis_quant = bool, overshoot_deringing = bool, optimize_scans = bool, quant_table = int, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- Q (int) – Q factor
- profile (str) – ICC profile to embed
- optimize_coding (bool) – Compute optimal Huffman coding tables
- interlace (bool) – Generate an interlaced (progressive) jpeg
- no_subsample (bool) – Disable chroma subsample
- trellis_quant (bool) – Apply trellis quantisation to each 8x8 block
- overshoot_deringing (bool) – Apply overshooting to samples with extreme values
- optimize_scans (bool) – Split the spectrum of DCT coefficients into separate scans
- quant_table (int) – Use predefined quantization table with given index
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
jpegsave_buffer
(Q = int, profile = str, optimize_coding = bool, interlace = bool, no_subsample = bool, trellis_quant = bool, overshoot_deringing = bool, optimize_scans = bool, quant_table = int, strip = bool, background = list[float])¶ Save image to jpeg buffer.
- Example:
- buffer = in.jpegsave_buffer(Q = int, profile = str, optimize_coding = bool, interlace = bool, no_subsample = bool, trellis_quant = bool, overshoot_deringing = bool, optimize_scans = bool, quant_table = int, strip = bool, background = list[float])
Parameters: - Q (int) – Q factor
- profile (str) – ICC profile to embed
- optimize_coding (bool) – Compute optimal Huffman coding tables
- interlace (bool) – Generate an interlaced (progressive) jpeg
- no_subsample (bool) – Disable chroma subsample
- trellis_quant (bool) – Apply trellis quantisation to each 8x8 block
- overshoot_deringing (bool) – Apply overshooting to samples with extreme values
- optimize_scans (bool) – Split the spectrum of DCT coefficients into separate scans
- quant_table (int) – Use predefined quantization table with given index
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: str
Raises: Error –
-
jpegsave_mime
(Q = int, profile = str, optimize_coding = bool, interlace = bool, no_subsample = bool, trellis_quant = bool, overshoot_deringing = bool, optimize_scans = bool, quant_table = int, strip = bool, background = list[float])¶ Save image to jpeg mime.
- Example:
- = in.jpegsave_mime(Q = int, profile = str, optimize_coding = bool, interlace = bool, no_subsample = bool, trellis_quant = bool, overshoot_deringing = bool, optimize_scans = bool, quant_table = int, strip = bool, background = list[float])
Parameters: - Q (int) – Q factor
- profile (str) – ICC profile to embed
- optimize_coding (bool) – Compute optimal Huffman coding tables
- interlace (bool) – Generate an interlaced (progressive) jpeg
- no_subsample (bool) – Disable chroma subsample
- trellis_quant (bool) – Apply trellis quantisation to each 8x8 block
- overshoot_deringing (bool) – Apply overshooting to samples with extreme values
- optimize_scans (bool) – Split the spectrum of DCT coefficients into separate scans
- quant_table (int) – Use predefined quantization table with given index
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
webpsave
(filename, Q = int, lossless = bool, preset = str, smart_subsample = bool, near_lossless = bool, alpha_q = int, strip = bool, background = list[float])¶ Save image to webp file.
- Example:
- = in.webpsave(filename, Q = int, lossless = bool, preset = str, smart_subsample = bool, near_lossless = bool, alpha_q = int, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- Q (int) – Q factor
- lossless (bool) – enable lossless compression
- preset (str) – Preset for lossy compression
- smart_subsample (bool) – Enable high quality chroma subsampling
- near_lossless (bool) – Enable preprocessing in lossless mode (uses Q)
- alpha_q (int) – Change alpha plane fidelity for lossy compression
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
webpsave_buffer
(Q = int, lossless = bool, preset = str, smart_subsample = bool, near_lossless = bool, alpha_q = int, strip = bool, background = list[float])¶ Save image to webp buffer.
- Example:
- buffer = in.webpsave_buffer(Q = int, lossless = bool, preset = str, smart_subsample = bool, near_lossless = bool, alpha_q = int, strip = bool, background = list[float])
Parameters: - Q (int) – Q factor
- lossless (bool) – enable lossless compression
- preset (str) – Preset for lossy compression
- smart_subsample (bool) – Enable high quality chroma subsampling
- near_lossless (bool) – Enable preprocessing in lossless mode (uses Q)
- alpha_q (int) – Change alpha plane fidelity for lossy compression
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: str
Raises: Error –
-
tiffsave
(filename, compression = str, Q = int, predictor = str, profile = str, tile = bool, tile_width = int, tile_height = int, pyramid = bool, miniswhite = bool, squash = bool, resunit = str, xres = float, yres = float, bigtiff = bool, properties = bool, strip = bool, background = list[float])¶ Save image to tiff file.
- Example:
- = in.tiffsave(filename, compression = str, Q = int, predictor = str, profile = str, tile = bool, tile_width = int, tile_height = int, pyramid = bool, miniswhite = bool, squash = bool, resunit = str, xres = float, yres = float, bigtiff = bool, properties = bool, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- compression (str) – Compression for this file
- Q (int) – Q factor
- predictor (str) – Compression prediction
- profile (str) – ICC profile to embed
- tile (bool) – Write a tiled tiff
- tile_width (int) – Tile width in pixels
- tile_height (int) – Tile height in pixels
- pyramid (bool) – Write a pyramidal tiff
- miniswhite (bool) – Use 0 for white in 1-bit images
- squash (bool) – Squash images down to 1 bit
- resunit (str) – Resolution unit
- xres (float) – Horizontal resolution in pixels/mm
- yres (float) – Vertical resolution in pixels/mm
- bigtiff (bool) – Write a bigtiff image
- properties (bool) – Write a properties document to IMAGEDESCRIPTION
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
tiffsave_buffer
(compression = str, Q = int, predictor = str, profile = str, tile = bool, tile_width = int, tile_height = int, pyramid = bool, miniswhite = bool, squash = bool, resunit = str, xres = float, yres = float, bigtiff = bool, properties = bool, strip = bool, background = list[float])¶ Save image to tiff buffer.
- Example:
- buffer = in.tiffsave_buffer(compression = str, Q = int, predictor = str, profile = str, tile = bool, tile_width = int, tile_height = int, pyramid = bool, miniswhite = bool, squash = bool, resunit = str, xres = float, yres = float, bigtiff = bool, properties = bool, strip = bool, background = list[float])
Parameters: - compression (str) – Compression for this file
- Q (int) – Q factor
- predictor (str) – Compression prediction
- profile (str) – ICC profile to embed
- tile (bool) – Write a tiled tiff
- tile_width (int) – Tile width in pixels
- tile_height (int) – Tile height in pixels
- pyramid (bool) – Write a pyramidal tiff
- miniswhite (bool) – Use 0 for white in 1-bit images
- squash (bool) – Squash images down to 1 bit
- resunit (str) – Resolution unit
- xres (float) – Horizontal resolution in pixels/mm
- yres (float) – Vertical resolution in pixels/mm
- bigtiff (bool) – Write a bigtiff image
- properties (bool) – Write a properties document to IMAGEDESCRIPTION
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: str
Raises: Error –
-
fitssave
(filename, strip = bool, background = list[float])¶ Save image to fits file.
- Example:
- = in.fitssave(filename, strip = bool, background = list[float])
Parameters: - filename (str) – Filename to save to
- strip (bool) – Strip all metadata from image
- background (list[float]) – Background value
Return type: list[]
Raises: Error –
-
static
thumbnail
(filename, width, height = int, size = str, auto_rotate = bool, crop = str, linear = bool, import_profile = str, export_profile = str)¶ Generate thumbnail from file.
- Example:
- out = pyvips.Image.thumbnail(filename, width, height = int, size = str, auto_rotate = bool, crop = str, linear = bool, import_profile = str, export_profile = str)
Parameters: - filename (str) – Filename to read from
- width (int) – Size to this width
- height (int) – Size to this height
- size (str) – Only upsize, only downsize, or both
- auto_rotate (bool) – Use orientation tags to rotate image upright
- crop (str) – Reduce to fill target rectangle, then crop
- linear (bool) – Reduce in linear light
- import_profile (str) – Fallback import profile
- export_profile (str) – Fallback export profile
Return type: Raises: Error –
-
static
thumbnail_buffer
(buffer, width, height = int, size = str, auto_rotate = bool, crop = str, linear = bool, import_profile = str, export_profile = str)¶ Generate thumbnail from buffer.
- Example:
- out = pyvips.Image.thumbnail_buffer(buffer, width, height = int, size = str, auto_rotate = bool, crop = str, linear = bool, import_profile = str, export_profile = str)
Parameters: - buffer (str) – Buffer to load from
- width (int) – Size to this width
- height (int) – Size to this height
- size (str) – Only upsize, only downsize, or both
- auto_rotate (bool) – Use orientation tags to rotate image upright
- crop (str) – Reduce to fill target rectangle, then crop
- linear (bool) – Reduce in linear light
- import_profile (str) – Fallback import profile
- export_profile (str) – Fallback export profile
Return type: Raises: Error –
-
mapim
(index, interpolate = GObject)¶ Resample with an mapim image.
- Example:
- out = in.mapim(index, interpolate = GObject)
Parameters: Return type: Raises: Error –
-
shrink
(hshrink, vshrink)¶ Shrink an image.
- Example:
- out = in.shrink(hshrink, vshrink)
Parameters: - hshrink (float) – Horizontal shrink factor
- vshrink (float) – Vertical shrink factor
Return type: Raises: Error –
-
shrinkh
(hshrink)¶ Shrink an image horizontally.
- Example:
- out = in.shrinkh(hshrink)
Parameters: hshrink (int) – Horizontal shrink factor Return type: Image Raises: Error –
-
shrinkv
(vshrink)¶ Shrink an image vertically.
- Example:
- out = in.shrinkv(vshrink)
Parameters: vshrink (int) – Vertical shrink factor Return type: Image Raises: Error –
-
reduceh
(hshrink, kernel = str, centre = bool)¶ Shrink an image horizontally.
- Example:
- out = in.reduceh(hshrink, kernel = str, centre = bool)
Parameters: - hshrink (float) – Horizontal shrink factor
- kernel (str) – Resampling kernel
- centre (bool) – Use centre sampling convention
Return type: Raises: Error –
-
reducev
(vshrink, kernel = str, centre = bool)¶ Shrink an image vertically.
- Example:
- out = in.reducev(vshrink, kernel = str, centre = bool)
Parameters: - vshrink (float) – Vertical shrink factor
- kernel (str) – Resampling kernel
- centre (bool) – Use centre sampling convention
Return type: Raises: Error –
-
reduce
(hshrink, vshrink, kernel = str, centre = bool)¶ Reduce an image.
- Example:
- out = in.reduce(hshrink, vshrink, kernel = str, centre = bool)
Parameters: - hshrink (float) – Horizontal shrink factor
- vshrink (float) – Vertical shrink factor
- kernel (str) – Resampling kernel
- centre (bool) – Use centre sampling convention
Return type: Raises: Error –
-
quadratic
(coeff, interpolate = GObject)¶ Resample an image with a quadratic transform.
- Example:
- out = in.quadratic(coeff, interpolate = GObject)
Parameters: Return type: Raises: Error –
-
affine
(matrix, interpolate = GObject, oarea = list[int], odx = float, ody = float, idx = float, idy = float)¶ Affine transform of an image.
- Example:
- out = in.affine(matrix, interpolate = GObject, oarea = list[int], odx = float, ody = float, idx = float, idy = float)
Parameters: - matrix (list[float]) – Transformation matrix
- interpolate (GObject) – Interpolate pixels with this
- oarea (list[int]) – Area of output to generate
- odx (float) – Horizontal output displacement
- ody (float) – Vertical output displacement
- idx (float) – Horizontal input displacement
- idy (float) – Vertical input displacement
Return type: Raises: Error –
-
similarity
(interpolate = GObject, scale = float, angle = float, odx = float, ody = float, idx = float, idy = float)¶ Similarity transform of an image.
- Example:
- out = in.similarity(interpolate = GObject, scale = float, angle = float, odx = float, ody = float, idx = float, idy = float)
Parameters: - interpolate (GObject) – Interpolate pixels with this
- scale (float) – Scale by this factor
- angle (float) – Rotate anticlockwise by this many degrees
- odx (float) – Horizontal output displacement
- ody (float) – Vertical output displacement
- idx (float) – Horizontal input displacement
- idy (float) – Vertical input displacement
Return type: Raises: Error –
-
resize
(scale, kernel = str, centre = bool, vscale = float)¶ Resize an image.
- Example:
- out = in.resize(scale, kernel = str, centre = bool, vscale = float)
Parameters: - scale (float) – Scale image by this factor
- kernel (str) – Resampling kernel
- centre (bool) – Use centre sampling convention
- vscale (float) – Vertical scale image by this factor
Return type: Raises: Error –
-
colourspace
(space, source_space = str)¶ Convert to a new colorspace.
- Example:
- out = in.colourspace(space, source_space = str)
Parameters: - space (str) – Destination color space
- source_space (str) – Source color space
Return type: Raises: Error –
-
Lab2XYZ
(temp = list[float])¶ Transform CIELAB to XYZ.
- Example:
- out = in.Lab2XYZ(temp = list[float])
Parameters: temp (list[float]) – Color temperature Return type: Image Raises: Error –
-
XYZ2Lab
(temp = list[float])¶ Transform XYZ to Lab.
- Example:
- out = in.XYZ2Lab(temp = list[float])
Parameters: temp (list[float]) – Colour temperature Return type: Image Raises: Error –
-
LabQ2Lab
()¶ Unpack a LabQ image to float Lab.
- Example:
- out = in.LabQ2Lab()
Return type: Image Raises: Error –
-
Lab2LabQ
()¶ Transform float Lab to LabQ coding.
- Example:
- out = in.Lab2LabQ()
Return type: Image Raises: Error –
-
LabQ2LabS
()¶ Unpack a LabQ image to short Lab.
- Example:
- out = in.LabQ2LabS()
Return type: Image Raises: Error –
-
LabS2LabQ
()¶ Transform short Lab to LabQ coding.
- Example:
- out = in.LabS2LabQ()
Return type: Image Raises: Error –
-
LabS2Lab
()¶ Transform signed short Lab to float.
- Example:
- out = in.LabS2Lab()
Return type: Image Raises: Error –
-
Lab2LabS
()¶ Transform float Lab to signed short.
- Example:
- out = in.Lab2LabS()
Return type: Image Raises: Error –
-
rad2float
()¶ Unpack Radiance coding to float RGB.
- Example:
- out = in.rad2float()
Return type: Image Raises: Error –
-
float2rad
()¶ Transform float RGB to Radiance coding.
- Example:
- out = in.float2rad()
Return type: Image Raises: Error –
-
LabQ2sRGB
()¶ Convert a LabQ image to sRGB.
- Example:
- out = in.LabQ2sRGB()
Return type: Image Raises: Error –
-
icc_import
(pcs = str, intent = str, embedded = bool, input_profile = str)¶ Import from device with ICC profile.
- Example:
- out = in.icc_import(pcs = str, intent = str, embedded = bool, input_profile = str)
Parameters: - pcs (str) – Set Profile Connection Space
- intent (str) – Rendering intent
- embedded (bool) – Use embedded input profile, if available
- input_profile (str) – Filename to load input profile from
Return type: Raises: Error –
-
icc_export
(pcs = str, intent = str, output_profile = str, depth = int)¶ Output to device with ICC profile.
- Example:
- out = in.icc_export(pcs = str, intent = str, output_profile = str, depth = int)
Parameters: - pcs (str) – Set Profile Connection Space
- intent (str) – Rendering intent
- output_profile (str) – Filename to load output profile from
- depth (int) – Output device space depth in bits
Return type: Raises: Error –
-
icc_transform
(output_profile, pcs = str, intent = str, embedded = bool, input_profile = str, depth = int)¶ Transform between devices with ICC profiles.
- Example:
- out = in.icc_transform(output_profile, pcs = str, intent = str, embedded = bool, input_profile = str, depth = int)
Parameters: - output_profile (str) – Filename to load output profile from
- pcs (str) – Set Profile Connection Space
- intent (str) – Rendering intent
- embedded (bool) – Use embedded input profile, if available
- input_profile (str) – Filename to load input profile from
- depth (int) – Output device space depth in bits
Return type: Raises: Error –
-
dE76
(right)¶ Calculate dE76.
- Example:
- out = left.dE76(right)
Parameters: right (Image) – Right-hand input image Return type: Image Raises: Error –
-
dE00
(right)¶ Calculate dE00.
- Example:
- out = left.dE00(right)
Parameters: right (Image) – Right-hand input image Return type: Image Raises: Error –
-
dECMC
(right)¶ Calculate dECMC.
- Example:
- out = left.dECMC(right)
Parameters: right (Image) – Right-hand input image Return type: Image Raises: Error –
-
sRGB2scRGB
()¶ Convert an sRGB image to scRGB.
- Example:
- out = in.sRGB2scRGB()
Return type: Image Raises: Error –
-
scRGB2BW
(depth = int)¶ Convert scRGB to BW.
- Example:
- out = in.scRGB2BW(depth = int)
Parameters: depth (int) – Output device space depth in bits Return type: Image Raises: Error –
-
scRGB2sRGB
(depth = int)¶ Convert an scRGB image to sRGB.
- Example:
- out = in.scRGB2sRGB(depth = int)
Parameters: depth (int) – Output device space depth in bits Return type: Image Raises: Error –
-
maplut
(lut, band = int)¶ Map an image though a lut.
- Example:
- out = in.maplut(lut, band = int)
Parameters: - lut (Image) – Look-up table image
- band (int) – apply one-band lut to this band of in
Return type: Raises: Error –
-
percent
(percent)¶ Find threshold for percent of pixels.
- Example:
- threshold = in.percent(percent)
Parameters: percent (float) – Percent of pixels Return type: int Raises: Error –
-
stdif
(width, height, s0 = float, b = float, m0 = float, a = float)¶ Statistical difference.
- Example:
- out = in.stdif(width, height, s0 = float, b = float, m0 = float, a = float)
Parameters: - width (int) – Window width in pixels
- height (int) – Window height in pixels
- s0 (float) – New deviation
- b (float) – Weight of new deviation
- m0 (float) – New mean
- a (float) – Weight of new mean
Return type: Raises: Error –
-
hist_cum
()¶ Form cumulative histogram.
- Example:
- out = in.hist_cum()
Return type: Image Raises: Error –
-
hist_match
(ref)¶ Match two histograms.
- Example:
- out = in.hist_match(ref)
Parameters: ref (Image) – Reference histogram Return type: Image Raises: Error –
-
hist_equal
(band = int)¶ Histogram equalisation.
- Example:
- out = in.hist_equal(band = int)
Parameters: band (int) – Equalise with this band Return type: Image Raises: Error –
-
hist_local
(width, height, max_slope = int)¶ Local histogram equalisation.
- Example:
- out = in.hist_local(width, height, max_slope = int)
Parameters: - width (int) – Window width in pixels
- height (int) – Window height in pixels
- max_slope (int) – Maximum slope (CLAHE)
Return type: Raises: Error –
-
hist_ismonotonic
()¶ Test for monotonicity.
- Example:
- monotonic = in.hist_ismonotonic()
Return type: bool Raises: Error –
-
hist_entropy
()¶ Estimate image entropy.
- Example:
- out = in.hist_entropy()
Return type: float Raises: Error –
-
conv
(mask, precision = str, layers = int, cluster = int)¶ Convolution operation.
- Example:
- out = in.conv(mask, precision = str, layers = int, cluster = int)
Parameters: - mask (Image) – Input matrix image
- precision (str) – Convolve with this precision
- layers (int) – Use this many layers in approximation
- cluster (int) – Cluster lines closer than this in approximation
Return type: Raises: Error –
-
conva
(mask, layers = int, cluster = int)¶ Approximate integer convolution.
- Example:
- out = in.conva(mask, layers = int, cluster = int)
Parameters: - mask (Image) – Input matrix image
- layers (int) – Use this many layers in approximation
- cluster (int) – Cluster lines closer than this in approximation
Return type: Raises: Error –
-
convf
(mask)¶ Float convolution operation.
- Example:
- out = in.convf(mask)
Parameters: mask (Image) – Input matrix image Return type: Image Raises: Error –
-
convi
(mask)¶ Int convolution operation.
- Example:
- out = in.convi(mask)
Parameters: mask (Image) – Input matrix image Return type: Image Raises: Error –
-
compass
(mask, times = int, angle = str, combine = str, precision = str, layers = int, cluster = int)¶ Convolve with rotating mask.
- Example:
- out = in.compass(mask, times = int, angle = str, combine = str, precision = str, layers = int, cluster = int)
Parameters: - mask (Image) – Input matrix image
- times (int) – Rotate and convolve this many times
- angle (str) – Rotate mask by this much between convolutions
- combine (str) – Combine convolution results like this
- precision (str) – Convolve with this precision
- layers (int) – Use this many layers in approximation
- cluster (int) – Cluster lines closer than this in approximation
Return type: Raises: Error –
-
convsep
(mask, precision = str, layers = int, cluster = int)¶ Seperable convolution operation.
- Example:
- out = in.convsep(mask, precision = str, layers = int, cluster = int)
Parameters: - mask (Image) – Input matrix image
- precision (str) – Convolve with this precision
- layers (int) – Use this many layers in approximation
- cluster (int) – Cluster lines closer than this in approximation
Return type: Raises: Error –
-
convasep
(mask, layers = int)¶ Approximate separable integer convolution.
- Example:
- out = in.convasep(mask, layers = int)
Parameters: - mask (Image) – Input matrix image
- layers (int) – Use this many layers in approximation
Return type: Raises: Error –
-
fastcor
(ref)¶ Fast correlation.
- Example:
- out = in.fastcor(ref)
Parameters: ref (Image) – Input reference image Return type: Image Raises: Error –
-
spcor
(ref)¶ Spatial correlation.
- Example:
- out = in.spcor(ref)
Parameters: ref (Image) – Input reference image Return type: Image Raises: Error –
-
sharpen
(sigma = float, x1 = float, y2 = float, y3 = float, m1 = float, m2 = float)¶ Unsharp masking for print.
- Example:
- out = in.sharpen(sigma = float, x1 = float, y2 = float, y3 = float, m1 = float, m2 = float)
Parameters: - sigma (float) – Sigma of Gaussian
- x1 (float) – Flat/jaggy threshold
- y2 (float) – Maximum brightening
- y3 (float) – Maximum darkening
- m1 (float) – Slope for flat areas
- m2 (float) – Slope for jaggy areas
Return type: Raises: Error –
-
gaussblur
(sigma, min_ampl = float, precision = str)¶ Gaussian blur.
- Example:
- out = in.gaussblur(sigma, min_ampl = float, precision = str)
Parameters: - sigma (float) – Sigma of Gaussian
- min_ampl (float) – Minimum amplitude of Gaussian
- precision (str) – Convolve with this precision
Return type: Raises: Error –
-
invfft
(real = bool)¶ Inverse FFT.
- Example:
- out = in.invfft(real = bool)
Parameters: real (bool) – Output only the real part of the transform Return type: Image Raises: Error –
-
freqmult
(mask)¶ Frequency-domain filtering.
- Example:
- out = in.freqmult(mask)
Parameters: mask (Image) – Input mask image Return type: Image Raises: Error –
-
spectrum
()¶ Make displayable power spectrum.
- Example:
- out = in.spectrum()
Return type: Image Raises: Error –
-
phasecor
(in2)¶ Calculate phase correlation.
- Example:
- out = in.phasecor(in2)
Parameters: in2 (Image) – Second input image Return type: Image Raises: Error –
-
morph
(mask, morph)¶ Morphology operation.
- Example:
- out = in.morph(mask, morph)
Parameters: - mask (Image) – Input matrix image
- morph (str) – Morphological operation to perform
Return type: Raises: Error –
-
rank
(width, height, index)¶ Rank filter.
- Example:
- out = in.rank(width, height, index)
Parameters: - width (int) – Window width in pixels
- height (int) – Window height in pixels
- index (int) – Select pixel at index
Return type: Raises: Error –
-
countlines
(direction)¶ Count lines in an image.
- Example:
- nolines = in.countlines(direction)
Parameters: direction (str) – Countlines left-right or up-down Return type: float Raises: Error –
-
labelregions
()¶ Label regions in an image.
- Example:
- mask = in.labelregions()
Return type: list[Image, int] Raises: Error –
-
draw_rect
(ink, left, top, width, height, fill = bool)¶ Paint a rectangle on an image.
- Example:
- = image.draw_rect(ink, left, top, width, height, fill = bool)
Parameters: - ink (list[float]) – Color for pixels
- left (int) – Rect to fill
- top (int) – Rect to fill
- width (int) – Rect to fill
- height (int) – Rect to fill
- fill (bool) – Draw a solid object
Return type: list[]
Raises: Error –
-
draw_mask
(ink, mask, x, y)¶ Draw a mask on an image.
- Example:
- = image.draw_mask(ink, mask, x, y)
Parameters: - ink (list[float]) – Color for pixels
- mask (Image) – Mask of pixels to draw
- x (int) – Draw mask here
- y (int) – Draw mask here
Return type: list[]
Raises: Error –
-
draw_line
(ink, x1, y1, x2, y2)¶ Draw a line on an image.
- Example:
- = image.draw_line(ink, x1, y1, x2, y2)
Parameters: - ink (list[float]) – Color for pixels
- x1 (int) – Start of draw_line
- y1 (int) – Start of draw_line
- x2 (int) – End of draw_line
- y2 (int) – End of draw_line
Return type: list[]
Raises: Error –
-
draw_circle
(ink, cx, cy, radius, fill = bool)¶ Draw a circle on an image.
- Example:
- = image.draw_circle(ink, cx, cy, radius, fill = bool)
Parameters: - ink (list[float]) – Color for pixels
- cx (int) – Centre of draw_circle
- cy (int) – Centre of draw_circle
- radius (int) – Radius in pixels
- fill (bool) – Draw a solid object
Return type: list[]
Raises: Error –
-
draw_flood
(ink, x, y, test = Image, equal = bool)¶ Flood-fill an area.
- Example:
- = image.draw_flood(ink, x, y, test = Image, equal = bool)
Parameters: - ink (list[float]) – Color for pixels
- x (int) – DrawFlood start point
- y (int) – DrawFlood start point
- test (Image) – Test pixels in this image
- equal (bool) – DrawFlood while equal to edge
Return type: list[int, int, int, int]
Raises: Error –
-
draw_image
(sub, x, y, mode = str)¶ Paint an image into another image.
- Example:
- = image.draw_image(sub, x, y, mode = str)
Parameters: - sub (Image) – Sub-image to insert into main image
- x (int) – Draw image here
- y (int) – Draw image here
- mode (str) – Combining mode
Return type: list[]
Raises: Error –
-
draw_smudge
(left, top, width, height)¶ Blur a rectangle on an image.
- Example:
- = image.draw_smudge(left, top, width, height)
Parameters: - left (int) – Rect to fill
- top (int) – Rect to fill
- width (int) – Rect to fill
- height (int) – Rect to fill
Return type: list[]
Raises: Error –
-
merge
(sec, direction, dx, dy, mblend = int)¶ Merge two images.
- Example:
- out = ref.merge(sec, direction, dx, dy, mblend = int)
Parameters: - sec (Image) – Secondary image
- direction (str) – Horizontal or vertcial merge
- dx (int) – Horizontal displacement from sec to ref
- dy (int) – Vertical displacement from sec to ref
- mblend (int) – Maximum blend size
Return type: Raises: Error –
-
mosaic
(sec, direction, xref, yref, xsec, ysec, hwindow = int, harea = int, mblend = int, bandno = int)¶ Mosaic two images.
- Example:
- out = ref.mosaic(sec, direction, xref, yref, xsec, ysec, hwindow = int, harea = int, mblend = int, bandno = int)
Parameters: - sec (Image) – Secondary image
- direction (str) – Horizontal or vertcial mosaic
- xref (int) – Position of reference tie-point
- yref (int) – Position of reference tie-point
- xsec (int) – Position of secondary tie-point
- ysec (int) – Position of secondary tie-point
- hwindow (int) – Half window size
- harea (int) – Half area size
- mblend (int) – Maximum blend size
- bandno (int) – Band to search for features on
Return type: list[Image, int, int, float, float, float, float]
Raises: Error –
-
mosaic1
(sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, hwindow = int, harea = int, search = bool, interpolate = GObject, mblend = int, bandno = int)¶ First-order mosaic of two images.
- Example:
- out = ref.mosaic1(sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, hwindow = int, harea = int, search = bool, interpolate = GObject, mblend = int, bandno = int)
Parameters: - sec (Image) – Secondary image
- direction (str) – Horizontal or vertcial mosaic
- xr1 (int) – Position of first reference tie-point
- yr1 (int) – Position of first reference tie-point
- xs1 (int) – Position of first secondary tie-point
- ys1 (int) – Position of first secondary tie-point
- xr2 (int) – Position of second reference tie-point
- yr2 (int) – Position of second reference tie-point
- xs2 (int) – Position of second secondary tie-point
- ys2 (int) – Position of second secondary tie-point
- hwindow (int) – Half window size
- harea (int) – Half area size
- search (bool) – Search to improve tie-points
- interpolate (GObject) – Interpolate pixels with this
- mblend (int) – Maximum blend size
- bandno (int) – Band to search for features on
Return type: Raises: Error –
-
match
(sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, hwindow = int, harea = int, search = bool, interpolate = GObject)¶ First-order match of two images.
- Example:
- out = ref.match(sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, hwindow = int, harea = int, search = bool, interpolate = GObject)
Parameters: - sec (Image) – Secondary image
- xr1 (int) – Position of first reference tie-point
- yr1 (int) – Position of first reference tie-point
- xs1 (int) – Position of first secondary tie-point
- ys1 (int) – Position of first secondary tie-point
- xr2 (int) – Position of second reference tie-point
- yr2 (int) – Position of second reference tie-point
- xs2 (int) – Position of second secondary tie-point
- ys2 (int) – Position of second secondary tie-point
- hwindow (int) – Half window size
- harea (int) – Half area size
- search (bool) – Search to improve tie-points
- interpolate (GObject) – Interpolate pixels with this
Return type: Raises: Error –
-
static