### Function

# Vips Image arrayjoin

#### Declaration [src]

    int
    vips_arrayjoin (
      VipsImage** in,
      VipsImage** out,
      int n,
      ...
    )

#### Description [src]

Lay out the images in `in` in a grid. The grid is `across` images across and however high is necessary to use up all of `in`. Images are set down left-to-right and top-to-bottom. `across` defaults to `n`.

Each input image is placed with a box of size `hspacing` by `vspacing` pixels and cropped. These default to the largest width and largest height of the input images.

Space between images is filled with `background`. This defaults to 0 (black).

Images are positioned within their `hspacing` by `vspacing` box at low, centre or high coordinate values, controlled by `halign` and `valign`. These default to left-top.

Boxes are joined and separated by `shim` pixels. This defaults to 0.

If the number of bands in the input images differs, all but one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the n-band images are operated upon.

The input images are cast up to the smallest common type (see table Smallest common format in arithmetic).

`vips_colourspace()` can be useful for moving the images to a common colourspace for compositing.

Optional arguments

- `across`: `gint`, number of images per row
- `shim`: `gint`, space between images, in pixels
- `background`: `VipsArrayDouble`, background ink colour
- `halign`: `VipsAlign`, low, centre or high alignment
- `valign`: `VipsAlign`, low, centre or high alignment
- `hspacing`: `gint`, horizontal distance between images
- `vspacing`: `gint`, vertical distance between images

See also

`vips_join()`, `vips_insert()`, `vips_colourspace()`.

This function is not directly available to language bindings.

#### Parameters

`in`

  Type: 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`

  Type: `VipsImage`

  Output image.

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

`n`

  Type: `int`

  Number of input images.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.