### Method

# Vips Image copy

#### Declaration [src]

    int
    vips_copy (
      VipsImage* in,
      VipsImage** out,
      ...
    )

#### Description [src]

Copy an image, optionally modifying the header. VIPS copies images by copying pointers, so this operation is instant, even for very large images.

You can optionally change any or all header fields during the copy. You can make any change which does not change the size of a pel, so for example you can turn a 4-band uchar image into a 2-band ushort image, but you cannot change a 100 x 100 RGB image into a 300 x 100 mono image.

Optional arguments

- `width`: `gint`, set image width
- `height`: `gint`, set image height
- `bands`: `gint`, set image bands
- `format`: `VipsBandFormat`, set image format
- `coding`: `VipsCoding`, set image coding
- `interpretation`: `VipsInterpretation`, set image interpretation
- `xres`: `gdouble`, set image xres
- `yres`: `gdouble`, set image yres
- `xoffset`: `gint`, set image xoffset
- `yoffset`: `gint`, set image yoffset

See also

`vips_byteswap()`, `vips_bandfold()`, `vips_bandunfold()`.

This method is not directly available to language bindings.

#### Parameters

`out`

  Type: `VipsImage`

  Output image.

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

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.