Constructor

VipsImagenew_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.

::: seealso vips_image_write_to_buffer().

Parameters

buf 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 size_t
 

Length of memory buffer.

option_string const char*
 

Set of extra options as a string.

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

NULL-terminated list of optional named arguments.

Return value

Returns: VipsImage
 

The new VipsImage, or NULL on error.

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