### Method

# GdkPixbuf Pixbuf save_to_buffer

since: 2.4

#### 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`

  Type: 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 caller of the method takes ownership of the returned data, and is responsible for freeing it.

`buffer_size`

  Type: `gsize*`

  Location to receive the size of the new buffer.

  The argument will be set by the function.

`type`

  Type: `const char*`

  Name of file format.

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

`error`

  Type: `GError`

  Return location for error, or `NULL`.

  The data is owned by the caller of the method.

`...`

  Type: ``

  List of key-value save options.

#### Return value

Type: `gboolean`

Whether an error was set.