### Method

# Vips Image jp2ksave

#### Declaration [src]

    int
    vips_jp2ksave (
      VipsImage* in,
      const char* filename,
      ...
    )

#### Description [src]

Write a VIPS image to a file in JPEG2000 format.

The saver supports 8, 16 and 32-bit int pixel values, signed and unsigned. It supports greyscale, RGB, CMYK and multispectral images.

Use `Q` to set the compression quality factor. The default value produces file with approximately the same size as regular JPEG Q 75.

Set `lossless` to enable lossless compression.

Use `tile_width` and `tile_height` to set the tile size. The default is 512.

Chroma subsampling is normally disabled for compatibility. Set `subsample_mode` to auto to enable chroma subsample for Q < 90. Subsample mode uses YCC rather than RGB colourspace, and many jpeg2000 decoders do not support this.

This operation always writes a pyramid.

Optional arguments

- `Q`: `gint`, quality factor
- `lossless`: `gboolean`, enables lossless compression
- `tile_width`: `gint`, tile width
- `tile_height`: `gint`, tile width
- `subsample_mode`: `VipsForeignSubsample`, chroma subsampling mode

See also

`vips_image_write_to_file()`, `vips_jp2kload()`.

This method is not directly available to language bindings.

#### Parameters

`filename`

  Type: `const char*`

  File to write 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.