### Method

# Vips Image magicksave_buffer

#### Declaration [src]

    int
    vips_magicksave_buffer (
      VipsImage* in,
      void** buf,
      size_t* len,
      ...
    )

#### Description [src]

As `vips_magicksave()`, but save to a memory buffer.

The address of the buffer is returned in `obuf`, the length of the buffer in `olen`. You are responsible for freeing the buffer with `g_free()` when you are done with it.

Optional arguments

- `quality`: `gint`, quality factor
- `format`: `gchararray`, format to save as
- `optimize_gif_frames`: `gboolean`, apply GIF frames optimization
- `optimize_gif_transparency`: `gboolean`, apply GIF transparency optimization
- `bitdepth`: `gint`, number of bits per pixel

See also

`vips_magicksave()`, `vips_image_write_to_file()`.

This method is not directly available to language bindings.

#### Parameters

`buf`

  Type: An array of `guint8`

  Return output buffer here.

  The length of the array is specified in the `len` argument.
  The data is owned by the caller of the method.

`len`

  Type: `size_t*`

  Return output 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.