### Method

# Vips Image write_to_buffer

#### Declaration [src]

    int
    vips_image_write_to_buffer (
      VipsImage* in,
      const char* suffix,
      void** buf,
      size_t* size,
      ...
    )

#### Description [src]

Writes `in` to a memory buffer in a format specified by `suffix`.

Save options may be appended to `suffix` as `[name=value,...]` or given as a `NULL`-terminated list of name-value pairs at the end of the arguments. Options given in the function call override options given in the filename.

Currently only TIFF, JPEG and PNG formats are supported.

You can call the various save operations directly if you wish, see `vips_jpegsave_buffer()`, for example.

See also

`vips_image_write_to_memory()`, `vips_image_new_from_buffer()`.

This method is not directly available to language bindings.

#### Parameters

`suffix`

  Type: `const char*`

  Format to write.

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

`buf`

  Type: An array of `guint8`

  Return buffer start here.

  The length of the array is specified in the `size` argument.
  The instance takes ownership of the data, and is responsible for freeing it.

`size`

  Type: `size_t*`

  Return buffer length here.

  The data is owned by the caller of the method.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.