### Constructor

# Vips Image new_from_buffer

#### Declaration [src]

    VipsImage*
    vips_image_new_from_buffer (
      void* buf,
      size_t len,
      const char* option_string,
      ...
    )

#### Description [src]

Loads an image from the formatted area of memory `buf`, `len` using the loader recommended by `vips_foreign_find_load_buffer()`. To load an unformatted area of memory, use `vips_image_new_from_memory()`.

VIPS does not take responsibility for the area of memory, it’s up to you to make sure it’s freed when the image is closed. See for example `VipsObject::close`.

Load options may be given in `option_string` 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.

See also

`vips_image_write_to_buffer()`.

This constructor is not directly available to language bindings.

#### Parameters

`buf`

  Type: An array of `guint8`

  Image data.

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

`len`

  Type: `size_t`

  Length of memory buffer.

`option_string`

  Type: `const char*`

  Set of extra options as a string.

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

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `VipsImage`

The new `VipsImage`, or `NULL` on error.

The caller of the function takes ownership of the data, and is responsible for freeing it.