Class
VipsImage
Description [src]
class Vips.Image : Vips.Object
{
/* No available fields */
}
The VipsImage
class and associated types and macros.
Images can be created from formatted files on disc, from C-style arrays on
disc, from formatted areas of memory, or from C-style arrays in memory. See
vips_image_new_from_file()
and friends.
Creating an image is fast. libvips reads just enough of
the image to be able to get the various properties, such as width in
pixels. It delays reading any pixels until they are really needed.
Once you have an image, you can get properties from it in the usual way.
You can use projection functions, like vips_image_get_width()
or
g_object_get()
, to get GObject
properties.
.v
images are three-dimensional arrays, the dimensions being width,
height and bands. Each dimension can be up to 2 ** 31 pixels (or band
elements). An image has a format, meaning the machine number type used
to represent each value. libvips supports 10 formats, from 8-bit unsigned
integer up to 128-bit double complex, see vips_image_get_format()
.
In libvips, images are uninterpreted arrays, meaning that from the point of view of most operations, they are just large collections of numbers. There’s no difference between an RGBA (RGB with alpha) image and a CMYK image, for example, they are both just four-band images. It’s up to the user of the library to pass the right sort of image to each operation.
To take an example, libvips has vips_Lab2XYZ()
, an operation to
transform an image from CIE LAB colour space to CIE XYZ space. It assumes
the first three bands represent pixels in LAB colour space and returns an
image where the first three bands are transformed to XYZ and any
remaining bands are just copied. Pass it an RGB image by mistake and
you’ll just get nonsense.
libvips has a feature to help (a little) with this: it sets a
VipsInterpretation
hint for each image (see
vips_image_get_interpretation()
); a hint which says how pixels should
be interpreted. For example, vips_Lab2XYZ()
will set the
interpretation of the output image to VIPS_INTERPRETATION_XYZ
.
A few utility operations will also use interpretation as a guide. For
example, you can give vips_colourspace()
an input image and a
desired colourspace and it will use the input’s interpretation hint to
apply the best sequence of colourspace transforms to get to the desired space.
Use things like vips_invert()
to manipulate your images. When you
are done, you can write images to disc files (with
vips_image_write_to_file()
), to formatted memory buffers (with
vips_image_write_to_buffer()
) and to C-style memory arrays (with
vips_image_write_to_memory()
).
You can also write images to other images. Create, for example, a temporary
disc image with vips_image_new_temp_file()
, then write your image to that
with vips_image_write()
. You can create several other types of image and
write to them, see vips_image_new_memory()
, for example.
See VipsOperation
for an introduction to running operations on images,
see Image headers for getting and setting image
metadata. See VipsObject
for a discussion of the lower levels.
Constructors
vips_image_memory
A renamed vips_image_new_memory()
… Some gobject binding systems do not
like more than one _new() method.
vips_image_new
vips_image_new()
creates a new, empty VipsImage
.
If you write to one of these images, vips will just attach some callbacks,
no pixels will be generated.
vips_image_new_from_buffer
Loads an image from the formatted area of memory buf
, len
using the
loader recommended by vips_foreign_find_load_buffer()
.
To load an unformatted area of memory, use
vips_image_new_from_memory()
.
vips_image_new_from_file
Optional arguments
access
: hintVipsAccess
mode to loadermemory
: force load via memory.
vips_image_new_from_file_RW
Opens the named file for simultaneous reading and writing. This will only work for VIPS files in a format native to your machine. It is only for paintbox-type applications.
vips_image_new_from_file_raw
This function maps the named file and returns a VipsImage
you can use to
read it.
vips_image_new_from_image
Creates a new image with width, height, format, interpretation, resolution
and offset taken from image
, but with number of bands taken from n
and the
value of each band element set from c
.
vips_image_new_from_image1
Creates a new image with width, height, format, interpretation, resolution
and offset taken from image
, but with one band and each pixel having the
value c
.
vips_image_new_from_memory
This function wraps a VipsImage
around a memory area. The memory area
must be a simple array, for example RGBRGBRGB, left-to-right,
top-to-bottom. Use vips_image_new_from_buffer()
to load an area of memory
containing an image in a format.
vips_image_new_from_memory_copy
Like vips_image_new_from_memory()
, but VIPS will make a copy of the memory
area. This means more memory use and an extra copy operation, but is much
simpler and safer.
vips_image_new_from_source
Loads an image from the formatted source input
,
loader recommended by vips_foreign_find_load_source()
.
vips_image_new_matrix
This convenience function makes an image which is a matrix: a one-band
VIPS_FORMAT_DOUBLE
image held in memory.
vips_image_new_matrixv
As vips_image_new_matrix()
, but initialise the matrix from the argument
list. After height
should be width
* height
double constants which are
used to set the matrix elements.
vips_image_new_memory
vips_image_new_memory()
creates a new VipsImage
which, when written to, will
create a memory image.
vips_image_new_temp_file
Make a VipsImage
which, when written to, will create a temporary file on
disc. The file will be automatically deleted when the image is destroyed.
format
is something like “%s.v” for a vips file.
vips_analyzeload
Load an Analyze 6.0 file. If filename
is “fred.img”, this will look for
an image header called “fred.hdr” and pixel data in “fred.img”. You can
also load “fred” or “fred.hdr”.
vips_fractsurf
Generate an image of size width
by height
and fractal dimension
fractal_dimension
. The dimension should be between 2 and 3.
vips_system
Optional arguments
in
: array of input imagesout
: output imagein_format
: write input files like thisout_format
: write output filename like thislog
: stdout of command is returned here.
Functions
vips_image_matrix_from_array
A renamed vips_image_new_matrix_from_array()
. Some gobject bindings do not
like more than one _new method.
vips_image_pipeline_array
Add an image to a pipeline. image
depends on all of the images in in
,
image
prefers to supply pixels according to hint
.
vips_switch
The tests
images are evaluated and at each point the index of the first
non-zero value is written to out
. If all tests
are false, the value
(n
+ 1) is written.
Instance methods
vips_CMYK2XYZ
Turn CMYK to XYZ. If the image has an embedded ICC profile this will be used for the conversion. If there is no embedded profile, a generic fallback profile will be used.
vips_abs
This operation finds the absolute value of an image. It does a copy for
unsigned integer types, negate for negative values in
signed integer types,
vips_andimage_const
Perform VIPS_OPERATION_BOOLEAN_AND
on an image and an array of constants.
See vips_boolean_const()
.
vips_andimage_const1
Perform VIPS_OPERATION_BOOLEAN_AND
on an image and a constant.
See vips_boolean_const1()
.
vips_atan2_const
Perform VIPS_OPERATION_MATH2_ATAN2
on an image and a constant. See
vips_math2_const()
.
vips_atan2_const1
Perform VIPS_OPERATION_MATH2_ATAN2
on an image and a constant. See
vips_math2_const()
.
vips_autorot_remove_angle
Remove the orientation tag on image
. Also remove any exif orientation tags.
You must vips_copy()
the image before calling this function since it
modifies metadata.
vips_avg
This operation finds the average value in an image. It operates on all
bands of the input image: use vips_stats()
if you need to calculate an
average for each band. For complex images, return the average modulus.
vips_bandbool
Perform various boolean operations across the bands of an image. For example, a three-band uchar image operated on with
VIPS_OPERATION_BOOLEAN_AND will produce a one-band uchar image where each
pixel is the bitwise and of the band elements of the corresponding pixel in the input image.
vips_bandmean
This operation writes a one-band image where each pixel is the average of the bands for that pixel in the input image. The output band format is the same as the input band format. Integer types use round-to-nearest averaging.
vips_boolean_const1
Perform various boolean operations on an image with a single constant. See
vips_boolean_const()
.
vips_buildlut
This operation builds a lookup table from a set of points. Intermediate
values are generated by piecewise linear interpolation. The lookup table is
always of type #VIPS_FORMAT_DOUBLE, use vips_cast()
to change it to the
type you need.
vips_canny
Optional arguments
sigma
: %gdouble, sigma for gaussian blurprecision
:VipsPrecision
, calculation accuracy.
vips_complexform
Compose two real images to make a complex image. If either left
or right
are VIPS_FORMAT_DOUBLE
, out
is VIPS_FORMAT_DPCOMPLEX
. Otherwise out
is VIPS_FORMAT_COMPLEX
. left
becomes the real component of out
and
right
the imaginary.
vips_convf
Convolution. This is a low-level operation, see vips_conv()
for something
more convenient.
vips_convi
Integer convolution. This is a low-level operation, see vips_conv()
for
something more convenient.
vips_copy_file
A simple convenience function to copy an image to a file, then copy again to output. If the image is already a file, just copy straight through.
vips_image_copy_memory
This function allocates memory, renders image
into it, builds a new
image around the memory area, and returns that.
vips_countlines
Function which calculates the number of transitions between black and white for the horizontal or the vertical direction of an image. black<128 , white>=128 The function calculates the number of transitions for all Xsize or Ysize and returns the mean of the result Input should be one band, 8-bit.
vips_dECMC
Calculate dE CMC. The input images are transformed to CMC colour space and the euclidean distance between corresponding pixels calculated.
vips_image_decode
A convenience function to unpack to a format that we can compute with.
out
.coding is always VIPS_CODING_NONE
.
vips_image_decode_predict
We often need to know what an image will decode to without actually decoding it, for example, in arg checking.
vips_deviate
This operation finds the standard deviation of all pixels in in
. It
operates on all bands of the input image: use vips_stats()
if you need
to calculate an average for each band.
vips_divide
This operation calculates in1
/ in2
and writes the result to out
. If any
pixels in in2
are zero, the corresponding pixel in out
is also zero.
vips_draw_mask
Draw mask
on the image. mask
is a monochrome 8-bit image with 0/255
for transparent or ink
coloured points. Intermediate values blend the ink
with the pixel. Use with vips_text()
to draw text on an image. Use in a
vips_draw_line()
subclass to draw an object along a line.
vips_draw_smudge
Smudge a section of image
. Each pixel in the area left
, top
, width
,
height
is replaced by the average of the surrounding 3x3 pixels.
vips_eorimage_const
Perform VIPS_OPERATION_BOOLEAN_EOR
on an image and an array of constants.
See vips_boolean_const()
.
vips_eorimage_const1
Perform VIPS_OPERATION_BOOLEAN_EOR
on an image and a constant.
See vips_boolean_const1()
.
vips_equal_const
Perform VIPS_OPERATION_RELATIONAL_EQUAL
on an image and a constant. See
vips_relational_const()
.
vips_equal_const1
Perform VIPS_OPERATION_RELATIONAL_EQUAL
on an image and a constant. See
vips_relational_const()
.
vips_falsecolour
Force in
to 1 band, 8-bit, then transform to
a 3-band 8-bit image with a false colour
map. The map is supposed to make small differences in brightness more obvious.
vips_find_trim
Optional arguments
threshold
: %gdouble, background / object thresholdbackground
:VipsArrayDouble
, background colourline_art
: %gboolean, enable line art mode.
vips_foreign_load_invalidate
Loaders can call this on the image they are making if they see a read error from the load library. It signals “invalidate” on the load operation and will cause it to be dropped from cache.
vips_image_free_buffer
Free the externally allocated buffer found in the input image. This function is intended to be used with g_signal_connect.
vips_image_get_area
Gets data
from image
under the name name
. A convenience
function over vips_image_get()
. Use vips_image_get_typeof()
to
test for the existence of a piece of metadata.
vips_image_get_array_double
Gets out
from im
under the name name
.
The field must be of type VIPS_TYPE_ARRAY_INT
.
vips_image_get_array_int
Gets out
from im
under the name name
.
The field must be of type VIPS_TYPE_ARRAY_INT
.
vips_image_get_as_string
Returns name
from image
in out
.
This function will read any field, returning it as a printable string.
You need to free the string with g_free()
when you are done with it.
vips_image_get_concurrency
Fetch and sanity-check VIPS_META_CONCURRENCY
. Default to 1 if not
present or crazy.
vips_image_get_data
Return a pointer to the image’s pixel data, if possible. This can involve allocating large amounts of memory and performing a long computation. Image pixels are laid out in band-packed rows.
vips_image_get_fields
Get a NULL
-terminated array listing all the metadata field names on image
.
Free the return result with g_strfreev()
.
vips_image_get_history
This function reads the image history as a C string. The string is owned by VIPS and must not be freed.
vips_image_get_interpretation
Return the VipsInterpretation
set in the image header.
Use vips_image_guess_format()
if you want a sanity-checked value.
vips_image_get_mode
Image modes are things like "t"
, meaning a memory buffer, and "p"
meaning a delayed computation.
vips_image_get_n_pages
Fetch and sanity-check VIPS_META_N_PAGES
. Default to 1 if not present
or crazy.
vips_image_get_n_subifds
Fetch and sanity-check VIPS_META_N_SUBIFDS
. Default to 0 if not
present or crazy.
vips_image_get_offset
Matrix images can have an optional offset
field for use by integer convolution.
vips_image_get_orientation
Fetch and sanity-check VIPS_META_ORIENTATION
. Default to 1 (no rotate,
no flip) if not present or crazy.
vips_image_get_orientation_swap
Return TRUE
if applying the orientation would swap width and height.
vips_image_get_page_height
Multi-page images can have a page height. Fetch it, and sanity check it. If page-height is not set, it defaults to the image height.
vips_image_get_string
Gets out
from im
under the name name
.
The field must be of type G_TYPE_STRING
or VIPS_TYPE_REF_STRING
.
vips_get_tile_size
Pick a tile size and a buffer height for this image and the current
value of vips_concurrency_get()
. The buffer height
will always be a multiple of tile_height.
vips_image_guess_format
Return the VipsBandFormat
for an image, guessing a sane value if
the set value looks crazy.
vips_image_guess_interpretation
Return the VipsInterpretation
for an image, guessing a sane value if
the set value looks crazy.
vips_image_hasalpha
Look at an image’s interpretation and see if it has extra alpha bands. For
example, a 4-band VIPS_INTERPRETATION_sRGB
would, but a six-band
VIPS_INTERPRETATION_MULTIBAND
would not.
vips_hist_match
Adjust in
to match ref
. If in
and ref
are normalised
cumulative histograms, out
will be a LUT that adjusts the PDF of the image
from which in
was made to match the PDF of ref
‘s image.
vips_hist_norm
Normalise histogram. The maximum of each band becomes equal to the maximum index, so for example the max for a uchar image becomes 255. Normalise each band separately.
vips_hist_plot
Plot a 1 by any or any by 1 image file as a max by any or any by max image using these rules:.
vips_image_history_args
Formats the name/argv as a single string and calls
vips_image_history_printf()
. A convenience function for
command-line programs.
vips_image_history_printf
Add a line to the image history. The format
and arguments are expanded, the
date and time is appended prefixed with a hash character, and the whole
string is appended to the image history and terminated with a newline.
vips_hough_circle
Optional arguments
scale
: scale down dimensions by this muchmin_radius
: smallest radius to search formax_radius
: largest radius to search for.
vips_hough_line
Optional arguments
width
: horizontal size of parameter spaceheight
: vertical size of parameter space.
vips_icc_ac2rc
Transform an image from absolute to relative colorimetry using the MediaWhitePoint stored in the ICC profile.
vips_image_get
Fill value_copy
with a copy of the header field. value_copy
must be zeroed
but uninitialised.
vips_image_get_blob
Gets data
from image
under the name name
, optionally returns its
length in length
. Use vips_image_get_typeof()
to test for the existence
of a piece of metadata.
vips_image_get_double
Gets out
from im
under the name name
.
The value will be transformed into a double, if possible.
vips_image_get_image
Gets out
from im
under the name name
.
The field must be of type VIPS_TYPE_IMAGE
.
You must unref out
with g_object_unref()
.
vips_image_get_int
Gets out
from im
under the name name
.
The value will be transformed into an int, if possible.
vips_image_get_typeof
Read the GType
for a header field. Returns zero if there
is no field of that name.
vips_image_set
Set a piece of metadata on image
. Any old metadata with that name is
destroyed. The GValue
is copied into the image, so you need to unset the
value when you’re done with it.
vips_image_init_fields
A convenience function to set the header fields after creating an image.
Normally you copy the fields from your input images with
[method.Image.pipelinev] and then make any adjustments you need,
but if you are creating an image from scratch, for example
vips_black()
or vips_jpegload()
, you do need to set all the
fields yourself.
vips_image_inplace
Gets image
ready for an in-place operation, such as
vips_draw_circle()
. After calling this function you can both read
and write the image with VIPS_IMAGE_ADDR().
vips_image_invalidate_all
Invalidate all pixel caches on image
and any downstream images, that
is, images which depend on this image. Additionally, all operations which
depend upon this image are dropped from the VIPS operation cache.
vips_invert
For unsigned formats, this operation calculates (max - in
), eg. (255 -
in
) for uchar. For signed and float formats, this operation calculates (-1
in
).
vips_image_isMSBfirst
Return TRUE
if image
is in most-significant-
byte first form. This is the byte order used on the SPARC
architecture and others.
vips_image_is_sequential
TRUE if any of the images upstream from image
were opened in sequential
mode. Some operations change behaviour slightly in sequential mode to
optimize memory behaviour.
vips_image_iskilled
If image
has been killed (see vips_image_set_kill()
), set an error message,
clear the VipsImage
.kill flag and return TRUE
. Otherwise return FALSE
.
vips_less_const
Perform VIPS_OPERATION_RELATIONAL_LESS
on an image and a constant. See
vips_relational_const()
.
vips_less_const1
Perform VIPS_OPERATION_RELATIONAL_LESS
on an image and a constant. See
vips_relational_const()
.
vips_lesseq_const
Perform VIPS_OPERATION_RELATIONAL_LESSEQ
on an image and a constant. See
vips_relational_const()
.
vips_lesseq_const1
Perform VIPS_OPERATION_RELATIONAL_LESSEQ
on an image and a constant. See
vips_relational_const()
.
vips_lshift_const
Perform VIPS_OPERATION_BOOLEAN_LSHIFT
on an image and an array of constants.
See vips_boolean_const()
.
vips_lshift_const1
Perform VIPS_OPERATION_BOOLEAN_LSHIFT
on an image and a constant.
See vips_boolean_const1()
.
vips_math2
This operation calculates a 2-ary maths operation on a pair of images
and writes the result to out
. The images may have any
non-complex format. out
is float except in the case that either of left
or right
are double, in which case out
is also double.
vips_math2_const
This operation calculates various 2-ary maths operations on an image and
an array of constants and writes the result to out
.
The image may have any
non-complex format. out
is float except in the case that in
is double, in which case out
is also double.
vips_math2_const1
This operation calculates various 2-ary maths operations on an image and
a constant. See vips_math2_const()
.
vips_matrixinvert
This operation calculates the inverse of the matrix represented in m
.
The scale and offset members of the input matrix are ignored.
vips_matrixprint
Print in
to %stdout in matrix format. See vips_matrixload()
for a
description of the format.
vips_matrixsave
Write in
to filename
in matrix format. See vips_matrixload()
for a
description of the format.
vips_max
Optional arguments
x
: horizontal position of maximumy
: vertical position of maximumsize
: number of maxima to findout_array
: return array of maximum valuesx_array
: corresponding horizontal positionsy_array
: corresponding vertical positions.
vips_measure
Optional arguments
left
: area of image containing charttop
: area of image containing chartwidth
: area of image containing chartheight
: area of image containing chart.
vips_min
Optional arguments
x
: horizontal position of minimumy
: vertical position of minimumsize
: number of minima to findout_array
: return array of minimum valuesx_array
: corresponding horizontal positionsy_array
: corresponding vertical positions.
vips_image_minimise_all
Minimise memory use on this image and any upstream images, that is, images which this image depends upon. This function is called automatically at the end of a computation, but it might be useful to call at other times.
vips_more_const
Perform VIPS_OPERATION_RELATIONAL_MORE
on an image and a constant. See
vips_relational_const()
.
vips_more_const1
Perform VIPS_OPERATION_RELATIONAL_MORE
on an image and a constant. See
vips_relational_const()
.
vips_moreeq_const
Perform VIPS_OPERATION_RELATIONAL_MOREEQ
on an image and a constant. See
vips_relational_const()
.
vips_moreeq_const1
Perform VIPS_OPERATION_RELATIONAL_MOREEQ
on an image and a constant. See
vips_relational_const()
.
vips_notequal_const
Perform VIPS_OPERATION_RELATIONAL_NOTEQ
on an image and a constant. See
vips_relational_const()
.
vips_notequal_const1
Perform VIPS_OPERATION_RELATIONAL_NOTEQ
on an image and a constant. See
vips_relational_const()
.
vips_orimage_const
Perform VIPS_OPERATION_BOOLEAN_OR
on an image and an array of constants.
See vips_boolean_const()
.
vips_orimage_const1
Perform VIPS_OPERATION_BOOLEAN_OR
on an image and a constant.
See vips_boolean_const1()
.
vips_percent
Vips_percent() returns (through the threshold
parameter) the threshold
below which there are percent
values of in
. For example:.
vips_phasecor
Convert the two input images to Fourier space, calculate phase-correlation, back to real space.
vips_image_pio_input
Check that an image is readable with vips_region_prepare()
and friends.
If it isn’t, try to transform the image so that vips_region_prepare()
can work.
vips_image_pio_output
Check that an image is writeable with vips_image_generate()
. If it isn’t,
try to transform the image so that vips_image_generate()
can work.
vips_pow_const1
Perform VIPS_OPERATION_MATH2_POW
on an image and a constant. See
vips_math2_const()
.
vips_profile
vips_profile()
searches inward from the edge of in
and finds the
first non-zero pixel. Pixels in columns
have the distance from the top edge
to the first non-zero pixel in that column, rows
has the distance from the
left edge to the first non-zero pixel in that row.
vips_project
Find the horizontal and vertical projections of an image, ie. the sum of every row of pixels, and the sum of every column of pixels. The output format is uint, int or double, depending on the input format.
vips_rank
Vips_rank() does rank filtering on an image. A window of size width
by
height
is passed over the image. At each position, the pixels inside the
window are sorted into ascending order and the pixel at position index
is
output. index
numbers from 0.
vips_recomb
This operation recombines an image’s bands. Each pixel in in
is treated as
an n-element vector, where n is the number of bands in in
, and multiplied by
the n x m matrix m
to produce the m-band image out
.
vips_relational_const1
Perform various relational operations on an image and a constant. See
vips_relational_const()
.
vips_remainder
This operation calculates left
% right
(remainder after integer division)
and writes the result to out
. The images may have any
non-complex format. For float formats, vips_remainder()
calculates in1
-
in2
* floor (in1
/ in2
).
vips_remainder_const
This operation calculates in
% c
(remainder after division by an
array of constants)
and writes the result to out
.
The image may have any
non-complex format. For float formats, vips_remainder_const()
calculates
in
- c
* floor (in
/ c
).
vips_remainder_const1
This operation calculates in
% c
(remainder after division by a
constant)
and writes the result to out
.
The image may have any
non-complex format. For float formats, vips_remainder_const()
calculates
in
- c
* floor (in
/ c
).
vips_remosaic
Vips_remosaic() works rather as vips_globalbalance(). It takes apart the
mosaiced image in
and rebuilds it, substituting images.
vips_image_remove
Find and remove an item of metadata. Return FALSE
if no metadata of that
name was found.
vips_reorder_margin_hint
vips_reorder_margin_hint()
sets a hint that image
contains a
margin, that is, that each vips_region_prepare()
on image
will request
a slightly larger region from it’s inputs. A good value for margin
is
(width * height) for the window the operation uses.
vips_reorder_prepare_many
vips_reorder_prepare_many()
runs vips_region_prepare()
on each
region in regions
, requesting the pixels in r
.
vips_rshift_const
Perform VIPS_OPERATION_BOOLEAN_LSHIFT
on an image and an array of constants.
See vips_boolean_const()
.
vips_rshift_const1
Perform VIPS_OPERATION_BOOLEAN_RSHIFT
on an image and a constant.
See vips_boolean_const1()
.
vips_image_set_area
Attaches data
as a metadata item on image
under the name name
. When
VIPS no longer needs the metadata, it will be freed with free_fn
.
vips_image_set_array_double
Attaches array
as a metadata item on image
as name
.
A convenience function over vips_image_set()
.
vips_image_set_array_int
Attaches array
as a metadata item on image
as name
.
A convenience function over vips_image_set()
.
vips_image_set_blob_copy
Attaches data
as a metadata item on image
under the name name
, taking
a copy of the memory area.
vips_image_set_delete_on_close
Sets the delete_on_close flag for the image. If this flag is set, when
image
is finalized, the filename held in image
->filename at the time of
this call is deleted.
vips_image_set_double
Attaches d
as a metadata item on image
as name
. A
convenience function over vips_image_set()
.
vips_image_set_image
Attaches im
as a metadata item on image
as name
.
A convenience function over vips_image_set()
.
vips_image_set_int
Attaches i
as a metadata item on image
under the name name
. A
convenience function over vips_image_set()
.
vips_image_set_progress
Vips signals evaluation progress via the VipsImage::preeval
,
VipsImage::eval
and VipsImage::posteval
signals. Progress is signalled on the most-downstream image for which
vips_image_set_progress()
was called.
vips_image_set_string
Attaches str
as a metadata item on image
as name
.
A convenience
function over vips_image_set()
using VIPS_TYPE_REF_STRING
.
vips_sign
Finds the unit vector in the direction of the pixel value. For non-complex images, it returns a signed char image with values -1, 0, and 1 for negative, zero and positive pixels. For complex images, it returns a complex normalised to length 1.
vips_sink
Loops over an image. generate_fn
is called for every pixel in
the image, with the reg
argument being a region of calculated pixels.
vips_sink()
is used to implement operations like
vips_avg()
which have no image output.
vips_sink_disc
Vips_sink_disc() loops over im
, top-to-bottom, generating it in sections.
As each section is produced, write_fn
is called.
vips_sink_screen
This operation renders in
in the background, making pixels available
on out
as they are calculated. The notify_fn
callback is run every
time a new set of pixels are available. Calculated pixels are kept in
a cache with tiles sized tile_width
by tile_height
pixels and with at
most max_tiles
tiles. If max_tiles
is -1, the cache is of unlimited
size (up to the maximum image * size). The mask
image is a one-band
uchar image and has 255 for pixels which are currently in cache and 0
for uncalculated pixels.
vips_sink_tile
Loops over an image. generate_fn
is called for every
pixel in the image, with
the reg
argument being a region of calculated pixels.
vips_stats
Find many image statistics in a single pass through the data. out
is a
one-band VIPS_FORMAT_DOUBLE
image of at least 10 columns by n + 1
(where n is number of bands in image in
)
rows. Columns are statistics, and are, in order: minimum, maximum, sum,
sum of squares, mean, standard deviation, x coordinate of minimum, y
coordinate of minimum, x coordinate of maximum, y coordinate of maximum.
Later versions of vips_stats()
may add more columns.
vips_image_wio_input
Check that an image is readable via the VIPS_IMAGE_ADDR() macro, that is, that the entire image is in memory and all pixels can be read with VIPS_IMAGE_ADDR(). If it isn’t, try to transform it so that VIPS_IMAGE_ADDR() can work.
vips_wop_const1
Perform VIPS_OPERATION_MATH2_WOP
on an image and a constant. See
vips_math2_const()
.
vips_image_write
Write image
to out
. Use vips_image_new()
and friends to create the
VipsImage
you want to write to.
vips_image_write_line
Write a line of pixels to an image. This function must be called repeatedly
with ypos
increasing from 0 to VipsImage:height
.
linebuffer
must be VIPS_IMAGE_SIZEOF_LINE() bytes long.
vips_image_write_prepare
Call this after setting header fields (width, height, and so on) to allocate resources ready for writing.
Methods inherited from VipsObject (27)
Please see VipsObject for a full list of methods.
Signals
Vips.Image::eval
This signal is emitted once per work unit (typically a 128 x 128 area of pixels) during image computation.
Vips.Image::invalidate
This signal is emitted when an image or one of it’s
upstream data sources has been destructively modified. See
vips_image_invalidate_all()
.
Vips.Image::minimise
This signal is emitted when an image has been asked to
minimise memory usage. All non-essential caches are dropped.
See vips_image_minimise_all()
.
Vips.Image::posteval
This signal is emitted once at the end of the computation
of image
. It’s a good place to shut down evaluation feedback.
Vips.Image::preeval
This signal is emitted once before computation of image
starts. It’s a good place to set up evaluation feedback.
Vips.Image::written
This signal is emitted just after an image has been written to. It is used by vips to implement things like write to foreign file formats.
Signals inherited from VipsObject (4)
VipsObject::close
The ::close signal is emitted once during object close. The object is dying and may not work.
VipsObject::postbuild
The ::postbuild signal is emitted once just after successful object construction. Return non-zero to cause object construction to fail.
VipsObject::postclose
The ::postclose signal is emitted once after object close. The object pointer is still valid, but nothing else.
VipsObject::preclose
The ::preclose signal is emitted once just before object close starts. The object is still alive.
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Class structure
struct VipsImageClass {
VipsObjectClass parent_class;
void (* preeval) (
VipsImage* image,
VipsProgress* progress,
void* data
);
void (* eval) (
VipsImage* image,
VipsProgress* progress,
void* data
);
void (* posteval) (
VipsImage* image,
VipsProgress* progress,
void* data
);
void (* written) (
VipsImage* image,
int* result,
void* data
);
void (* invalidate) (
VipsImage* image,
void* data
);
void (* minimise) (
VipsImage* image,
void* data
);
}
No description available.
Class members
parent_class: VipsObjectClass
No description available.
preeval: void (* preeval) ( VipsImage* image, VipsProgress* progress, void* data )
No description available.
eval: void (* eval) ( VipsImage* image, VipsProgress* progress, void* data )
No description available.
posteval: void (* posteval) ( VipsImage* image, VipsProgress* progress, void* data )
No description available.
written: void (* written) ( VipsImage* image, int* result, void* data )
No description available.
invalidate: void (* invalidate) ( VipsImage* image, void* data )
No description available.
minimise: void (* minimise) ( VipsImage* image, void* data )
No description available.