Function

VipsImagecomposite

Declaration [src]

int
vips_composite (
  VipsImage** in,
  VipsImage** out,
  int n,
  int* mode,
  ...
)

Description [src]

Composite an array of images together.

Images are placed in a stack, with in[0] at the bottom and in[n - 1] at the top. Pixels are blended together working from the bottom upwards, with the blend mode at each step being set by the corresponding VipsBlendMode in mode.

Images are transformed to a compositing space before processing. This is VipsInterpretation, VipsInterpretation, VipsInterpretation, or VipsInterpretation by default, depending on how many bands and bits the input images have. You can select any other space, such as VipsInterpretation or VipsInterpretation.

The output image is in the compositing space. It will always be VipsBandFormat unless one of the inputs is VipsBandFormat, in which case the output will be double as well.

Complex images are not supported.

The output image will always have an alpha band. A solid alpha is added to any input missing an alpha.

The images do not need to match in size or format. The output image is always the size of in[0], with other images being positioned with the x and y parameters and clipped against that rectangle.

Image are normally treated as unpremultiplied, so this operation can be used directly on PNG images. If your images have been through vips_premultiply(), set premultiplied.

::: tip “Optional arguments” * compositing_space: VipsInterpretation to composite in * premultiplied: gboolean, images are already premultiplied * x: VipsArrayInt, array of (n - 1) x coordinates * y: VipsArrayInt, array of (n - 1) y coordinates

::: seealso vips_insert().

Parameters

in An array of VipsImage*
 

Array of input images.

 The length of the array is specified in the n argument.
 The data is owned by the caller of the function.
out VipsImage
 

Output image.

 The argument will be set by the function.
 The called function takes ownership of the data, and is responsible for freeing it.
n int
 

Number of input images.

mode int*
 

Array of (n - 1) VipsBlendMode

 The data is owned by the caller of the function.
... none
 

NULL-terminated list of optional named arguments.

Return value

Returns: int
 

0 on success, -1 on error.