Method
VipsImageget
Declaration [src]
int
vips_image_get (
const VipsImage* image,
const char* name,
GValue* value_copy
)
Description [src]
Fill value_copy
with a copy of the header field. value_copy
must be zeroed
but uninitialised.
This will return -1 and add a message to the error buffer if the field
does not exist. Use vips_image_get_typeof()
to test for the
existence of a field first if you are not certain it will be there.
For example, to read a double from an image (though of course you would use
vips_image_get_double()
in practice):
GValue value = { 0 };
double d;
if (vips_image_get (image, name, &value))
return -1;
if (G_VALUE_TYPE (&value) != G_TYPE_DOUBLE) {
vips_error( "mydomain",
_("field \"%s\" is of type %s, not double"),
name,
g_type_name (G_VALUE_TYPE (&value)));
g_value_unset (&value);
return -1;
}
d = g_value_get_double (&value);
g_value_unset (&value);
See also: vips_image_get_typeof(), vips_image_get_double().
Parameters
name |
const char* |
The name to fetch. |
|
The data is owned by the caller of the function. | |
The value is a NUL terminated UTF-8 string. | |
value_copy |
GValue |
The %GValue is copied into this. |
|
The argument will be set by the function. | |
The instance takes ownership of the data, and is responsible for freeing it. |