Top | Description | Object Hierarchy | ![]() | ![]() | ![]() | ![]() |
int | vips_black () |
int | vips_xyz () |
int | vips_grey () |
int | vips_gaussmat () |
int | vips_logmat () |
int | vips_text () |
int | vips_gaussnoise () |
int | vips_eye () |
int | vips_sines () |
int | vips_zone () |
int | vips_sdf () |
int | vips_identity () |
int | vips_buildlut () |
int | vips_invertlut () |
int | vips_tonelut () |
int | vips_mask_ideal () |
int | vips_mask_ideal_ring () |
int | vips_mask_ideal_band () |
int | vips_mask_butterworth () |
int | vips_mask_butterworth_ring () |
int | vips_mask_butterworth_band () |
int | vips_mask_gaussian () |
int | vips_mask_gaussian_ring () |
int | vips_mask_gaussian_band () |
int | vips_mask_fractal () |
int | vips_fractsurf () |
int | vips_worley () |
int | vips_perlin () |
These functions generate various images. You can combine them withthe arithmetic and rotate functions to build more complicated images.
intvips_black (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
bands
: output bands
Make a black unsigned char image of a specified size.
See also:vips_xyz()
,vips_text()
,vips_gaussnoise()
.
out | output image. | [out] |
width | output width | |
height | output height | |
... |
|
intvips_xyz (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
csize
:gint
, size for third dimension
dsize
:gint
, size for fourth dimension
esize
:gint
, size for fifth dimension
Create a two-band uint32 image where the elements in the first band have thevalue of their x coordinate and elements in the second band have their ycoordinate.
You can make any image where the value of a pixel is a function of its (x,y) coordinate by combining this operator with the arithmetic operators.
Setcsize
,dsize
,esize
to generate higher dimensions and add morebands. The extra dimensions are placed down the vertical axis. Usevips_grid()
to change the layout.
See also:vips_grey()
,vips_grid()
,vips_identity()
.
out | output image. | [out] |
width | horizontal size | |
height | vertical size | |
... |
|
intvips_grey (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
uchar
: output a uchar image
Create a one-band float image with the left-most column zero and theright-most 1. Intermediate pixels are a linear ramp.
Setuchar
to output a uchar image with the leftmost pixel 0 and therightmost 255.
See also:vips_xyz()
,vips_identity()
.
out | output image. | [out] |
width | image size | |
height | image size | |
... |
|
intvips_gaussmat (VipsImage **out
,double sigma
,double min_ampl
,...
);
Optional arguments:
separable
: generate a separable gaussian
precision
:VipsPrecision forout
Creates a circularly symmetric Gaussian image of radiussigma
. The size of the mask is determined by the variablemin_ampl
;if for instance the value .1 is entered this means that the produced maskis clipped at values less than 10 percent of the maximum amplitude.
The program uses the following equation:
H(r) = exp(-(r * r) / (2 *sigma
*sigma
))
The generated image has odd size and its maximum value is normalised to1.0, unlessprecision
isVIPS_PRECISION_INTEGER.
Ifseparable
is set, only the centre horizontal is generated. This isuseful for separable convolutions.
Ifprecision
isVIPS_PRECISION_INTEGER, an integer gaussian is generated.This is useful for integer convolutions.
"scale" is set to the sum of all the mask elements.
See also:vips_logmat()
,vips_conv()
.
out | output image. | [out] |
sigma | standard deviation of mask | |
min_ampl | minimum amplitude | |
... |
|
intvips_logmat (VipsImage **out
,double sigma
,double min_ampl
,...
);
Optional arguments:
separable
: generate a separable mask
precision
:VipsPrecision forout
Creates a circularly symmetric Laplacian of Gaussian maskof radiussigma
. The size of the mask is determined by the variablemin_ampl
;if for instance the value .1 is entered this means that the produced maskis clipped at values within 10 percent of zero, and where the changebetween mask elements is less than 10%.
The program uses the following equation: (from Handbook of PatternRecognition and image processing by Young and Fu, AP 1986 pages 220-221):
H(r) = (1 / (2 * M_PI * s4)) *(2 - (r2 / s2)) *exp(-r2 / (2 * s2))
where s2 =sigma
*sigma
, s4 = s2 * s2, r2 = r * r.
The generated mask has odd size and its maximum value is normalised to1.0, unlessprecision
isVIPS_PRECISION_INTEGER.
Ifseparable
is set, only the centre horizontal is generated. This isuseful for separable convolutions.
Ifprecision
isVIPS_PRECISION_INTEGER, an integer mask is generated.This is useful for integer convolutions.
"scale" is set to the sum of all the mask elements.
See also:vips_gaussmat()
,vips_conv()
.
out | output image. | [out] |
sigma | standard deviation of mask | |
min_ampl | minimum amplitude | |
... |
|
intvips_text (VipsImage **out
,constchar *text
,...
);
Optional arguments:
font
:gchararray
, font to render with
fontfile
:gchararray
, load this font file
width
:gint
, image should be no wider than this many pixels
height
:gint
, image should be no higher than this many pixels
align
:VipsAlign, set justification alignment
justify
:gboolean
, justify lines
dpi
:gint
, render at this resolution
autofit_dpi
:gint
, read out auto-fitted DPI
rgba
:gboolean
, enable RGBA output
spacing
:gint
, space lines by this in points
wrap
:VipsTextWrap, wrap lines on characters or words
Draw the stringtext
to an image.out
is normally a one-band 8-bitunsigned char image, with 0 for no text and 255 for text. Values betweenare used for anti-aliasing.
Setrgba
to enable RGBA output. This is useful for colour emoji rendering,or support for pango markup features like<spanforeground="red">Red!</span>
.
text
is the text to render as a UTF-8 string. It can contain Pango markup,for example<i>The</i>Guardian
.
font
is the font to render with, as a fontconfig name. Examples might besans 12
or perhapsbitstream charter bold 10
.
You can specify a font to load withfontfile
. You'll need to also set thename of the font withfont
.
width
is the number of pixels to word-wrap at. By default, lines of textwider than this will be broken at word boundaries.Usewrap
to set lines to wrap on word or character boundaries, or todisable line breaks.
Setjustify
to turn on line justification.align
can be used to set the alignment style for multi-linetext to the low (left) edge centre, or high (right) edge. Note that theoutput image can be wider thanwidth
if there are noword breaks, or narrower if the lines don't break exactly atwidth
.
height
is the maximum number of pixels high the generated text can be. Thisonly takes effect whendpi
is not set, andwidth
is set, making a box.In this case,vips_text()
will search for adpi
and set of line breakswhich will just fit the text intowidth
andheight
.
You can useautofit_dpi
to read out the DPI selected by auto fit.
dpi
sets the resolution to render at. "sans 12" at 72 dpi draws charactersapproximately 12 pixels high.
spacing
sets the line spacing, in points. It would typically be somethinglike font size times 1.2.
You can read the coordinate of the top edge of the character fromXoffset
/Yoffset
. This can be helpful if you need to line up the output ofseveralvips_text()
.
See also:vips_bandjoin()
,vips_composite()
.
out | output image. | [out] |
text | utf-8 text string to render | |
... |
|
intvips_gaussnoise (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
mean
: mean of generated pixels
sigma
: standard deviation of generated pixels
Make a one band float image of gaussian noise with the specifieddistribution. The noise distribution is created by averaging 12 randomnumbers with the appropriate weights.
See also:vips_black()
,vips_xyz()
,vips_text()
.
out | output image. | [out] |
width | output width | |
height | output height | |
... |
|
intvips_eye (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
factor
:gdouble
, maximum spatial frequency
uchar
:gboolean
, output a uchar image
Create a test pattern with increasing spatial frequency in X andamplitude in Y.factor
should be between 0 and 1 and determines themaximum spatial frequency.
Setuchar
to output a uchar image.
See also:vips_zone()
.
out | output image. | [out] |
width | image size | |
height | image size | |
... |
|
intvips_sines (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
hfreq
: horizontal frequency
vreq
: vertical frequency
uchar
: output a uchar image
Creates a float one band image of the a sine waveform in twodimensions.
The number of horizontal and vertical spatial frequencies aredetermined by the variableshfreq
andvfreq
respectively. Thefunction is useful for creating displayable sine waves andsquare waves in two dimensions.
If horfreq and verfreq are integers the resultant image is periodicaland therefore the Fourier transform does not present spikes
Pixels are normally in [-1, +1], setuchar
to output [0, 255].
See also:vips_grey()
,vips_xyz()
.
out | output image. | [out] |
width | image size | |
height | image size | |
... |
|
intvips_zone (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
uchar
: output a uchar image
Create a one-band image of a zone plate.
Pixels are normally in [-1, +1], setuchar
to output [0, 255].
See also:vips_eye()
,vips_xyz()
.
out | output image. | [out] |
width | image size | |
height | image size | |
... |
|
intvips_sdf (VipsImage **out
,int width
,int height
,VipsSdfShape shape
,...
);
Optional arguments:
a
:VipsArrayDouble, first point
b
:VipsArrayDouble, second point
r
:gfloat
, radius
corners
:VipsArrayDouble, corner radii
Create a signed distance field (SDF) image of the given shape. Differentshapes use different combinations of the optional arguments, see below.
shape
VIPS_SDF_SHAPE_CIRCLE: create a circle centred ona
, radiusr
.
shape
VIPS_SDF_SHAPE_BOX: create a box with top-left cornera
andbottom-right cornerb
.
shape
VIPS_SDF_SHAPE_ROUNDED_BOX: create a box with top-left cornera
and bottom-right cornerb
, whose four corners arerounded by the four-element float arraycorners
.corners
will default to0.0.
shape
VIPS_SDF_SHAPE_LINE: draw a line froma
tob
.
See also:vips_grey()
,vips_grid()
,vips_xyz()
.
out | output image. | [out] |
width | horizontal size | |
height | vertical size | |
shape | SDF to create | |
... |
|
intvips_identity (VipsImage **out
,...
);
Optional arguments:
bands
: number of bands to create
ushort
:TRUE
for an unsigned short identity
size
: number of LUT elements for a ushort image
Creates an identity lookup table, ie. one which will leave an imageunchanged when applied withvips_maplut()
. Each entry in the table has avalue equal to its position.
Use the arithmetic operations on these tables to make LUTs representingarbitrary functions.
Normally LUTs are 8-bit. Setushort
to create a 16-bit table.
Normally 16-bit tables have 65536 entries. You can set this smaller withsize
.
See also:vips_xyz()
,vips_maplut()
.
intvips_buildlut (VipsImage *in
,VipsImage **out
,...
);
This operation builds a lookup table from a set of points. Intermediatevalues are generated by piecewise linear interpolation. The lookup table isalways of typeVIPS_FORMAT_DOUBLE, usevips_cast()
to change it to thetype you need.
For example, consider this 2 x 2 matrix of (x, y) coordinates:
0 | 0 |
255 | 100 |
We then generate a 1 x 256 element LUT like this:
Index | Value |
---|---|
0 | 0 |
1 | 0.4 |
etc. | 0.4 |
255 | 100 |
This is then written as the output image, with the left column giving theindex in the image to place the value.
The (x, y) points don't need to be sorted: we do that. You can haveseveral Ys, each becomes a band in the output LUT. You don't need tostart at zero, any integer will do, including negatives.
See also:vips_identity()
,vips_invertlut()
,vips_cast()
,vips_maplut()
.
intvips_invertlut (VipsImage *in
,VipsImage **out
,...
);
Optional arguments:
size
: generate this much
Given a mask of target values and real values, generate a LUT whichwill map reals to targets. Handy for linearising images frommeasurements of a colour chart. All values in [0,1]. Piecewise linearinterpolation, extrapolate head and tail to 0 and 1.
Eg. input like this:
4 | 3 | ||
0.1 | 0.2 | 0.3 | 0.1 |
0.2 | 0.4 | 0.4 | 0.2 |
0.7 | 0.5 | 0.6 | 0.3 |
Means a patch with 10% reflectance produces an image with 20% inchannel 1, 30% in channel 2, and 10% in channel 3, and so on.
Inputs don't need to be sorted (we do that). Generate any precisionLUT, default to 256 elements.
It won't work too well for non-monotonic camera responses(we should fix this). Interpolation is simple piecewise linear; we ought todo something better really.
See also:vips_buildlut()
.
intvips_tonelut (VipsImage **out
,...
);
Optional arguments:
in_max
: input range
out_max
: output range
Lb
: black-point [0-100]
Lw
: white-point [0-100]
Ps
: shadow point (eg. 0.2)
Pm
: mid-tone point (eg. 0.5)
Ph
: highlight point (eg. 0.8)
S
: shadow adjustment (+/- 30)
M
: mid-tone adjustment (+/- 30)
H
: highlight adjustment (+/- 30)
vips_tonelut() generates a tone curve for the adjustment of imagelevels. It is mostly designed for adjusting the L* part of a LAB image ina way suitable for print work, but you can use it for other things too.
The curve is an unsigned 16-bit image with (in_max
+ 1) entries,each in the range [0,out_max
].
Lb
,Lw
are expressed as 0-100, as in LAB colour space. Youspecify the scaling for the input and output images with thein_max
andout_max
parameters.
intvips_mask_ideal (VipsImage **out
,int width
,int height
,double frequency_cutoff
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make an ideal high- or low-pass filter, that is, one with a sharp cutoffpositioned atfrequency_cutoff
, wherefrequency_cutoff
is inthe range 0 - 1.
This operation creates a one-band float image of the specified size.The image hasvalues in the range [0, 1] and is typically used for multiplying againstfrequency domain images to filter them.Masks are created with the DC component at (0, 0). The DC pixel alwayshas the value 1.0.
Setnodc
to not set the DC pixel.
Setoptical
to position the DC component in the centre of the image. Thismakes the mask suitable for multiplying against optical Fourier transforms.Seevips_wrap()
.
Setreject
to invert the sense ofthe filter. For example, low-pass becomes low-reject.
Setuchar
to output an 8-bit unsigned char image rather than afloat image. In this case, pixels are in the range [0 - 255].
See also:vips_mask_ideal()
,vips_mask_ideal_ring()
,vips_mask_ideal_band()
,vips_mask_butterworth()
,vips_mask_butterworth_ring()
,vips_mask_butterworth_band()
,vips_mask_gaussian()
,vips_mask_gaussian_ring()
,vips_mask_gaussian_band()
.
out | output image. | [out] |
width | image size | |
height | image size | |
frequency_cutoff | threshold at which filter ends | |
... |
|
intvips_mask_ideal_ring (VipsImage **out
,int width
,int height
,double frequency_cutoff
,double ringwidth
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make an ideal ring-pass or ring-reject filter, that is, one with a sharpring positioned atfrequency_cutoff
of widthwidth
, wherefrequency_cutoff
andwidth
are expressed as the range 0 - 1.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
frequency_cutoff | threshold at which filter ends | |
ringwidth | ring width | |
... |
|
intvips_mask_ideal_band (VipsImage **out
,int width
,int height
,double frequency_cutoff_x
,double frequency_cutoff_y
,double radius
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make an ideal band-pass or band-reject filter, that is, one with asharp cutoff around the pointfrequency_cutoff_x
,frequency_cutoff_y
,of sizeradius
.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
frequency_cutoff_x | position of band | |
frequency_cutoff_y | position of band | |
radius | size of band | |
... |
|
intvips_mask_butterworth (VipsImage **out
,int width
,int height
,double order
,double frequency_cutoff
,double amplitude_cutoff
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make an butterworth high- or low-pass filter, that is, one with a variable,smooth transitionpositioned atfrequency_cutoff
, wherefrequency_cutoff
is inrange 0 - 1. The shape of the curve is controlled byorder
--- higher values give a sharper transition. See Gonzalez and Wintz,Digital Image Processing, 1987.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
order | filter order | |
frequency_cutoff | frequency threshold | |
amplitude_cutoff | amplitude threshold | |
... |
|
intvips_mask_butterworth_ring (VipsImage **out
,int width
,int height
,double order
,double frequency_cutoff
,double amplitude_cutoff
,double ringwidth
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make a butterworth ring-pass or ring-reject filter, that is, one with avariable,smooth transitionpositioned atfrequency_cutoff
of widthwidth
, wherefrequency_cutoff
isin the range 0 - 1. The shape of the curve is controlled byorder
--- higher values give a sharper transition. See Gonzalez and Wintz,Digital Image Processing, 1987.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
order | filter order | |
frequency_cutoff | frequency threshold | |
amplitude_cutoff | amplitude threshold | |
ringwidth | ringwidth | |
... |
|
intvips_mask_butterworth_band (VipsImage **out
,int width
,int height
,double order
,double frequency_cutoff_x
,double frequency_cutoff_y
,double radius
,double amplitude_cutoff
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make an butterworth band-pass or band-reject filter, that is, one with avariable, smooth transition positioned atfrequency_cutoff_x
,frequency_cutoff_y
, of radiusradius
.The shape of the curve is controlled byorder
--- higher values give a sharper transition. See Gonzalez and Wintz,Digital Image Processing, 1987.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
order | filter order | |
frequency_cutoff_x | band position | |
frequency_cutoff_y | band position | |
radius | band radius | |
amplitude_cutoff | amplitude threshold | |
... |
|
intvips_mask_gaussian (VipsImage **out
,int width
,int height
,double frequency_cutoff
,double amplitude_cutoff
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make a gaussian high- or low-pass filter, that is, one with a variable,smooth transition positioned atfrequency_cutoff
.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
frequency_cutoff | frequency threshold | |
amplitude_cutoff | amplitude threshold | |
... |
|
intvips_mask_gaussian_ring (VipsImage **out
,int width
,int height
,double frequency_cutoff
,double amplitude_cutoff
,double ringwidth
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make a gaussian ring-pass or ring-reject filter, that is, one with avariable, smooth transition positioned atfrequency_cutoff
of widthringwidth
.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
frequency_cutoff | frequency threshold | |
amplitude_cutoff | amplitude threshold | |
ringwidth | ringwidth | |
... |
|
intvips_mask_gaussian_band (VipsImage **out
,int width
,int height
,double frequency_cutoff_x
,double frequency_cutoff_y
,double radius
,double amplitude_cutoff
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
Make a gaussian band-pass or band-reject filter, that is, one with avariable, smooth transition positioned atfrequency_cutoff_x
,frequency_cutoff_y
, of radiusradius
.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
frequency_cutoff_x | band position | |
frequency_cutoff_y | band position | |
radius | band radius | |
amplitude_cutoff | amplitude threshold | |
... |
|
intvips_mask_fractal (VipsImage **out
,int width
,int height
,double fractal_dimension
,...
);
Optional arguments:
nodc
: don't set the DC pixel
reject
: invert the filter sense
optical
: coordinates in optical space
uchar
: output a uchar image
This operation should be used to create fractal images by filtering thepower spectrum of Gaussian white noise. Seevips_gaussnoise()
.
See also:vips_mask_ideal()
.
out | output image. | [out] |
width | image size | |
height | image size | |
fractal_dimension | fractal dimension | |
... |
|
intvips_fractsurf (VipsImage **out
,int width
,int height
,double fractal_dimension
,...
);
Generate an image of sizewidth
byheight
and fractal dimensionfractal_dimension
. The dimension should be between 2 and 3.
See also:vips_gaussnoise()
,vips_mask_fractal()
.
out | output image. | [out] |
width | output width | |
height | output height | |
fractal_dimension | fractal dimension | |
... |
|
intvips_worley (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
cell_size
:gint
, size of Worley cells
Create a one-band float image of Worley noise. See:
https://en.wikipedia.org/wiki/Worley_noise
Usecell_size
to set the size of the cells from which the image isconstructed. The default is 256 x 256.
Ifwidth
andheight
are multiples ofcell_size
, the image will tessellate.
See also:vips_perlin()
,vips_fractsurf()
,vips_gaussnoise()
.
out | output image. | [out] |
width | horizontal size | |
height | vertical size | |
... |
|
intvips_perlin (VipsImage **out
,int width
,int height
,...
);
Optional arguments:
cell_size
:gint
, size of Perlin cells
uchar
: output a uchar image
Create a one-band float image of Perlin noise. See:
https://en.wikipedia.org/wiki/Perlin_noise
Usecell_size
to set the size of the cells from which the image isconstructed. The default is 256 x 256.
Ifwidth
andheight
are multiples ofcell_size
, the image will tessellate.
Normally, output pixels areVIPS_FORMAT_FLOAT in the range [-1, +1]. Setuchar
to output a uchar image with pixels in [0, 255].
See also:vips_worley()
,vips_fractsurf()
,vips_gaussnoise()
.
out | output image. | [out] |
width | horizontal size | |
height | vertical size | |
... |
|
Sets the word wrapping style forvips_text()
when used with a maximumwidth.
See also:vips_text()
.