### Method

# GdkPixbuf Pixbuf save_to_buffer

#### Declaration [src]

    gboolean
    gdk_pixbuf_save_to_buffer (
      GdkPixbuf* pixbuf,
      gchar** buffer,
      gsize* buffer_size,
      const char* type,
      GError** error,
      ...
    )

#### Description [src]

Saves pixbuf to a new buffer in format `type`, which is currently “jpeg”, “png”, “tiff”, “ico” or “bmp”.

This is a convenience function that uses `gdk_pixbuf_save_to_callback()` to do the real work.

Note that the buffer is not `NUL`-terminated and may contain embedded `NUL` characters.

If `error` is set, `FALSE` will be returned and `buffer` will be set to `NULL`. Possible errors include those in the `GDK_PIXBUF_ERROR` domain.

See `gdk_pixbuf_save()` for more details.

Available since: | 2.4
This method is not directly available to language bindings.

#### Parameters

`buffer` | An array of `guint8`
| Location to receive a pointer to the new buffer.
| The argument will be set by the function.
| The length of the array is specified in the `buffer_size` argument.
| The instance takes ownership of the data, and is responsible for freeing it.
`buffer_size` | `gsize*`
| Location to receive the size of the new buffer.
| The argument will be set by the function.
`type` | `const char*`
| Name of file format.
| The data is owned by the caller of the function.
| The value is a NUL terminated UTF-8 string.
`error` | `GError`
| Return location for error, or `NULL`
| The argument can be `NULL`.
| The data is owned by the caller of the function.
`...` | ``
| List of key-value save options.

#### Return value

Returns: | `gboolean`
| Whether an error was set.