Vips.Image.new_from_memory (original) (raw)
Constructor
VipsImagenew_from_memory
Declaration [src]
VipsImage*
vips_image_new_from_memory (
void* data,
size_t size,
int width,
int height,
int bands,
VipsBandFormat format
)
Description [src]
This function wraps a VipsImage around a memory area. The memory area must be a simple array, for example RGBRGBRGB, left-to-right, top-to-bottom. Use vips_image_new_from_buffer() to load an area of memory containing an image in a format.
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.
Because VIPS is “borrowing” data from the caller, this function is extremely dangerous. Unless you are very careful, you will get crashes or memory corruption. Use vips_image_new_from_memory_copy() instead if you are at all unsure.
Use vips_copy() to set other image properties.
Parameters
data
Type: An array of guint8
Start of memory area.
| The length of the array is specified in the size argument. |
|---|
| The data is owned by the caller of the function. |
size
Type: size_t
Length of memory area.
width
Type: int
Image width.
height
Type: int
Image height.
bands
Type: int
Image bands (or bytes per pixel).
format
Type: VipsBandFormat
Image format.
Return value
The caller of the function takes ownership of the data, and is responsible for freeing it.