### Method

# Vips Image dzsave

#### Declaration [src]

    int
    vips_dzsave (
      VipsImage* in,
      const char* name,
      ...
    )

#### Description [src]

Save an image as a set of tiles at various resolutions. By default dzsave uses DeepZoom layout — use `layout` to pick other conventions.

`vips_dzsave()` creates a directory called `name` to hold the tiles. If `name` ends `.zip`, `vips_dzsave()` will create a zip file called `name` to hold the tiles. You can use `container` to force zip file output.

Use `basename` to set the name of the image we are creating. The default value is set from `name`.

By default, tiles are written as JPEGs. Use `Q` set set the JPEG quality factor.

You can set `suffix` to something like `".png[bitdepth=4]"` to write tiles in another format.

In Google layout mode, edge tiles are expanded to `tile_size` by `tile_size` pixels. Normally they are filled with white, but you can set another colour with `background`. Images are usually placed at the top-left of the tile, but you can have them centred by turning on `centre`.

You can set the size and overlap of tiles with `tile_size` and `overlap`. They default to the correct settings for the selected `layout`. The deepzoom defaults produce 256x256 jpeg files for centre tiles, the most efficient size.

Use `depth` to control how low the pyramid goes. This defaults to the correct setting for the `layout` you select.

You can rotate the image during write with the `angle` argument. However, this will only work for images which support random access, like openslide, and not for things like JPEG. You’ll need to rotate those images yourself with `vips_rot()`. Note that the `autorotate` option to the loader may do what you need.

By default, all tiles are stripped since usually you do not want a copy of all metadata in every tile. Set `keep` if you want to keep metadata.

If `container` is set to `zip`, you can set a compression level from -1 (use zlib default), 0 (store, compression disabled) to 9 (max compression). If no value is given, the default is to store files without compression.

You can use `region_shrink` to control the method for shrinking each 2x2 region. This defaults to using the average of the 4 input pixels but you can also use the median in cases where you want to preserve the range of values.

If you set `skip_blanks` to a value greater than or equal to zero, tiles which are all within that many pixel values to the background are skipped. This can save a lot of space for some image types. This option defaults to 5 in Google layout mode, -1 otherwise.

In IIIF layout, you can set the base of the `id` property in `info.json` with `id`. The default is `https://example.com/iiif`.

Use `layout` `VIPS_FOREIGN_DZ_LAYOUT_IIIF3` for IIIF v3 layout.

Optional arguments

- `basename`: `gchararray`, base part of name
- `layout`: `VipsForeignDzLayout`, directory layout convention
- `suffix`: `gchararray`, suffix for tiles
- `overlap`: `gint`, set tile overlap
- `tile_size`: `gint`, set tile size
- `background`: `VipsArrayDouble`, background colour
- `depth`: `VipsForeignDzDepth`, how deep to make the pyramid
- `centre`: `gboolean`, centre the tiles
- `angle`: `VipsAngle`, rotate the image by this much
- `container`: `VipsForeignDzContainer`, set container type
- `compression`: `gint`, zip deflate compression level
- `region_shrink`: `VipsRegionShrink`, how to shrink each 2x2 region
- `skip_blanks`: `gint`, skip tiles which are nearly equal to the background
- `id`: `gchararray`, id for IIIF properties
- `Q`: `gint`, quality factor

See also

`vips_tiffsave()`.

This method is not directly available to language bindings.

#### Parameters

`name`

  Type: `const char*`

  Name to save to.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.