![]() |
![]() |
![]() |
![]() |
enum | GExiv2Orientation |
enum | GExiv2StructureType |
enum | GExiv2XmpFormatFlags |
struct | GExiv2Metadata |
enum | WrapperSeekOrigin |
ManagedStreamCallbacks |
GExiv2Metadata is a generic object that provides everything from simple aggregated accessors to common data such as image comments up to fine-grained access to specific tags of a specific format, be it EXIF, IPTC or XMP
void
gexiv2_metadata_free (GExiv2Metadata *self
);
gexiv2_metadata_free
has been deprecated since version 0.10.3 and should not be used in newly-written code.
Use g_object_unref()
instead.
Destroys the GExiv2Metadata object and frees all associated memory.
gboolean gexiv2_metadata_open_path (GExiv2Metadata *self
,const gchar *path
,GError **error
);
The file must be an image format supported by Exiv2.
self |
An instance of GExiv2Metadata |
|
path |
Path to the file you want to open |
|
error |
[allow-none] |
gboolean gexiv2_metadata_open_buf (GExiv2Metadata *self
,const guint8 *data
,glong n_data
,GError **error
);
The buffer must be an image format supported by Exiv2.
self |
An instance of GExiv2Metadata |
|
data |
A buffer containing the data to be read. |
[array length=n_data] |
n_data |
The length of the buffer. |
[skip] |
error |
[allow-none] |
gboolean gexiv2_metadata_open_stream (GExiv2Metadata *self
,ManagedStreamCallbacks *cb
,GError **error
);
The stream must be an image format supported by Exiv2.
[skip]
self |
An instance of GExiv2Metadata |
|
cb |
A ManagedStreamCallbacks struct offering stream access. |
|
error |
[allow-none] |
gboolean gexiv2_metadata_from_app1_segment (GExiv2Metadata *self
,const guint8 *data
,glong n_data
,GError **error
);
Load only an EXIF buffer, typically stored in a JPEG's APP1 segment.
self |
An instance of GExiv2Metadata |
|
data |
A buffer containing the data to be read. |
[array length=n_data] |
n_data |
The length of the buffer. |
[skip] |
error |
[allow-none] |
gboolean gexiv2_metadata_save_external (GExiv2Metadata *self
,const gchar *path
,GError **error
);
Saves the metadata to the specified using an XMP sidecar file.
self |
An instance of GExiv2Metadata |
|
path |
Path to the file you want to save to. |
|
error |
[allow-none] |
Since: 0.10.6
gboolean gexiv2_metadata_save_file (GExiv2Metadata *self
,const gchar *path
,GError **error
);
Saves the metadata to the specified file by reading the file into memory,copying this object's metadata into the image, then writing the image back out.
self |
An instance of GExiv2Metadata |
|
path |
Path to the file you want to save to. |
|
error |
[allow-none] |
gboolean gexiv2_metadata_save_stream (GExiv2Metadata *self
,ManagedStreamCallbacks *cb
,GError **error
);
Saves the metadata to the stream by reading the stream into memory,copying this object's metadata into the image, then writing the image as a stream back out.
[skip]
self |
An instance of GExiv2Metadata |
|
cb |
A ManagedStreamCallbacks struct offering stream access. |
|
error |
[allow-none] |
gboolean gexiv2_metadata_has_tag (GExiv2Metadata *self
,const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
gboolean gexiv2_metadata_clear_tag (GExiv2Metadata *self
,const gchar *tag
);
Removes the Exiv2 tag from the metadata object.
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
void
gexiv2_metadata_clear (GExiv2Metadata *self
);
Removes all tags for all domains (EXIF, IPTC, and XMP).
gboolean
gexiv2_metadata_is_exif_tag (const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
gboolean
gexiv2_metadata_is_iptc_tag (const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
gboolean
gexiv2_metadata_is_xmp_tag (const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
const gchar *
gexiv2_metadata_get_tag_label (const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
const gchar *
gexiv2_metadata_get_tag_description (const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
const gchar *
gexiv2_metadata_get_tag_type (const gchar *tag
);
The names of the various Exiv2 tag types can be found at Exiv2::TypeId,
http://exiv2.org/doc/namespaceExiv2.html#5153319711f35fe81cbc13f4b852450cThe Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
gboolean
gexiv2_metadata_get_supports_exif (GExiv2Metadata *self
);
Query self
whether it supports writing EXIF metadata.
gboolean
gexiv2_metadata_get_supports_iptc (GExiv2Metadata *self
);
Query self
whether it supports writing IPTC metadata.
gboolean
gexiv2_metadata_get_supports_xmp (GExiv2Metadata *self
);
Query self
whether it supports writing XMP metadata.
const gchar *
gexiv2_metadata_get_mime_type (GExiv2Metadata *self
);
Query mime type of currently loaded image.
gint
gexiv2_metadata_get_pixel_width (GExiv2Metadata *self
);
Get the actual unoriented display width in pixels of the loaded image. May be different than the width reported by various metadata tags, i.e. "Exif.Photo.PixelXDimension".
gint
gexiv2_metadata_get_pixel_height (GExiv2Metadata *self
);
Get the actual unoriented display height in pixels of the loaded image. This may be different than the height reported by various metadata tags, i.e. "Exif.Photo.PixelYDimension".
gchar * gexiv2_metadata_get_tag_string (GExiv2Metadata *self
,const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
gboolean gexiv2_metadata_set_tag_string (GExiv2Metadata *self
,const gchar *tag
,const gchar *value
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
self |
An instance of GExiv2Metadata |
|
tag |
Exiv2 tag name |
|
value |
The value to set or replace the existing value |
gboolean gexiv2_metadata_set_xmp_tag_struct (GExiv2Metadata *self
,const gchar *tag
,GExiv2StructureType type
);
gchar * gexiv2_metadata_get_tag_interpreted_string (GExiv2Metadata *self
,const gchar *tag
);
An interpreted string is one fit for user display. It may display units or use formatting appropriate to the type of data the tag holds.
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
glong gexiv2_metadata_get_tag_long (GExiv2Metadata *self
,const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
gboolean gexiv2_metadata_set_tag_long (GExiv2Metadata *self
,const gchar *tag
,glong value
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
self |
An instance of GExiv2Metadata |
|
tag |
Exiv2 tag name |
|
value |
The value to set or replace the existing value |
gchar ** gexiv2_metadata_get_tag_multiple (GExiv2Metadata *self
,const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
gboolean gexiv2_metadata_set_tag_multiple (GExiv2Metadata *self
,const gchar *tag
,const gchar **values
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
self |
An instance of GExiv2Metadata |
|
tag |
Exiv2 tag name |
|
values |
An array of values to set or replace the existing value(s). |
[array zero-terminated=1] |
GBytes * gexiv2_metadata_get_tag_raw (GExiv2Metadata *self
,const gchar *tag
);
The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html
void
gexiv2_metadata_clear_exif (GExiv2Metadata *self
);
Clears all EXIF metadata from the loaded image.
gchar **
gexiv2_metadata_get_exif_tags (GExiv2Metadata *self
);
Query self
for a list of available EXIF tags
gboolean gexiv2_metadata_get_exif_tag_rational (GExiv2Metadata *self
,const gchar *tag
,gint *nom
,gint *den
);
Fetch EXIF tag
represented by a fraction. nom
will contain the numerator,
den
the denominator of the fraction on successful return.
self |
An instance of GExiv2Metadata |
|
tag |
The tag you want the rational value for. |
[in] |
nom |
The numerator. |
[out] |
den |
The denominator. |
[out] |
gboolean gexiv2_metadata_set_exif_tag_rational (GExiv2Metadata *self
,const gchar *tag
,gint nom
,gint den
);
Set EXIF tag
represented by a fraction, with nom
being the numerator,
den
the denominator of the fraction.
self |
An instance of GExiv2Metadata |
|
tag |
The Exiv2 tag. |
[in] |
nom |
Rational numerator |
|
den |
Rational denominator |
gboolean gexiv2_metadata_get_exif_thumbnail (GExiv2Metadata *self
,guint8 **buffer
,gint *size
);
Get the thumbnail stored in the EXIF data of self
self |
An instance of GExiv2Metadata |
|
buffer |
Where to store the thumbnail data. |
[out][array length=size][transfer full] |
size |
Size of the thumbnail's buffer. |
[skip] |
gboolean gexiv2_metadata_set_exif_thumbnail_from_file (GExiv2Metadata *self
,const gchar *path
,GError **error
);
Sets or replaces the EXIF thumbnail with the image in the file
void gexiv2_metadata_set_exif_thumbnail_from_buffer (GExiv2Metadata *self
,const guint8 *buffer
,gint size
);
self |
An instance of GExiv2Metadata |
|
buffer |
A buffer containing thumbnail data. |
[array length=size] |
size |
Size of the thumbnail's buffer. |
[skip] |
void
gexiv2_metadata_erase_exif_thumbnail (GExiv2Metadata *self
);
Removes the EXIF thumbnail from the loaded image.
void
gexiv2_metadata_clear_xmp (GExiv2Metadata *self
);
Clears all XMP metadata from the loaded image.
gchar * gexiv2_metadata_generate_xmp_packet (GExiv2Metadata *self
,GExiv2XmpFormatFlags xmp_format_flags
,guint32 padding
);
Encode the XMP packet as a NULL
-terminated string.
self |
An instance of GExiv2Metadata |
|
xmp_format_flags |
One of GExiv2XmpFormatFlags |
|
padding |
The padding (FIXME: Add documentation) |
gboolean gexiv2_metadata_register_xmp_namespace (const gchar *name
,const gchar *prefix
);
gboolean
gexiv2_metadata_unregister_xmp_namespace
(const gchar *name
);
void
gexiv2_metadata_unregister_all_xmp_namespaces
(void
);
void
gexiv2_metadata_clear_iptc (GExiv2Metadata *self
);
Clears all IPTC metadata from the loaded image.
gchar **
gexiv2_metadata_get_iptc_tags (GExiv2Metadata *self
);
Query self
for a list of available IPTC tags
GExiv2Orientation
gexiv2_metadata_get_orientation (GExiv2Metadata *self
);
The EXIF Orientation field
void gexiv2_metadata_set_orientation (GExiv2Metadata *self
,GExiv2Orientation orientation
);
The orientation must be valid and cannot be GEXIV2_ORIENTATION_UNSPECIFIED.
gint
gexiv2_metadata_get_metadata_pixel_width
(GExiv2Metadata *self
);
Composite accessor to query the pixel with stored in the metadata. This
might differ from the width of image that is available through
gexiv2_metadata_get_pixel_width()
gint
gexiv2_metadata_get_metadata_pixel_height
(GExiv2Metadata *self
);
Composite accessor to query the pixel with stored in the metadata. This
might differ from the height of image that is available through
gexiv2_metadata_get_pixel_height()
void gexiv2_metadata_set_metadata_pixel_width (GExiv2Metadata *self
,gint width
);
Composite setter to update the image's metadata with width
self |
An instance of GExiv2Metadata |
|
width |
The width of the image as it should be put into the metadata. |
void gexiv2_metadata_set_metadata_pixel_height (GExiv2Metadata *self
,gint height
);
Update the image's metadata with height
self |
An instance of GExiv2Metadata |
|
height |
The width of the image as it should be put into the metadata. |
gchar *
gexiv2_metadata_get_comment (GExiv2Metadata *self
);
A composite accessor that uses the first available metadata field from a list of well-known locations to find the photo's comment (or description).
MWG guidelines refer to these as Description: a textual description of a resource's content.
These fields are:
Exif.Image.ImageDescription (MWG Guidelines)
Exif.Photo.UserComment
Exif.Image.XPComment
Iptc.Application2.Caption (MWG Guidelines)
Xmp.dc.description (MWG Guidelines)
Xmp.acdsee.notes (Commonly requested, read only)
For fine-grained control, it's recommended to use Exiv2 tags directly rather than this method, which is more useful for quick or casual use.
void gexiv2_metadata_set_comment (GExiv2Metadata *self
,const gchar *comment
);
This is a composite setter that will set a number of fields to the supplied value. See gexiv2_metadata_get_comment for more information.
void
gexiv2_metadata_clear_comment (GExiv2Metadata *self
);
This is a composite clear method that will clear a number of fields. See gexiv2_metadata_get_comment for more information.
gboolean gexiv2_metadata_get_exposure_time (GExiv2Metadata *self
,gint *nom
,gint *den
);
Returns the exposure time in seconds (shutter speed, not date-time of exposure) as a rational. See https://en.wikipedia.org/wiki/Shutter_speed for more information.
gdouble
gexiv2_metadata_get_fnumber (GExiv2Metadata *self
);
See https://en.wikipedia.org/wiki/F-number for more information.
gdouble
gexiv2_metadata_get_focal_length (GExiv2Metadata *self
);
See https://en.wikipedia.org/wiki/Flange_focal_distance for more information.
gint
gexiv2_metadata_get_iso_speed (GExiv2Metadata *self
);
See https://en.wikipedia.org/wiki/Iso_speed for more information.
gboolean gexiv2_metadata_get_gps_longitude (GExiv2Metadata *self
,gdouble *longitude
);
Query the longitude stored in the GPS tags of self
self |
An instance of GExiv2Metadata |
|
longitude |
Variable to store the longitude value. |
[out] |
gboolean gexiv2_metadata_get_gps_latitude (GExiv2Metadata *self
,gdouble *latitude
);
Query the latitude stored in the GPS tags of self
gboolean gexiv2_metadata_get_gps_altitude (GExiv2Metadata *self
,gdouble *altitude
);
Convenience function to query the altitude stored in the GPS tags of the image
gboolean gexiv2_metadata_get_gps_info (GExiv2Metadata *self
,gdouble *longitude
,gdouble *latitude
,gdouble *altitude
);
Convenience function to query all available GPS information at once.
self |
An instance of GExiv2Metadata |
|
longitude |
Storage for longitude value. |
[out] |
latitude |
Storage for latitude value. |
[out] |
altitude |
Storage for altitude value. |
[out] |
gboolean gexiv2_metadata_set_gps_info (GExiv2Metadata *self
,gdouble longitude
,gdouble latitude
,gdouble altitude
);
Convenience function to query all available GPS information at once.
self |
An instance of GExiv2Metadata |
|
longitude |
Longitude value to set or replace current value |
|
latitude |
Latitude value to set or replace current value |
|
altitude |
Altitude value to set or replace current value |
void
gexiv2_metadata_delete_gps_info (GExiv2Metadata *self
);
Removes all GPS metadata from the loaded image
GExiv2PreviewProperties **
gexiv2_metadata_get_preview_properties
(GExiv2Metadata *self
);
An image may have stored one or more previews, often of different qualities, sometimes of different image formats than the containing image. This call returns the properties of all previews Exiv2 finds within the loaded image. Use gexiv2_metadata_get_preview_image to load a particular preview into memory.
An array of GExiv2PreviewProperties instances, one for each preview present in the loaded image.
[transfer none][allow-none][array zero-terminated=1]
GExiv2PreviewImage * gexiv2_metadata_get_preview_image (GExiv2Metadata *self
,GExiv2PreviewProperties *props
);
gboolean
(*Stream_CanSeek) (void *handle
);
Function that returns the seekability of the stream
gboolean
(*Stream_CanRead) (void *handle
);
Function that returns the readability of the stream
gboolean
(*Stream_CanWrite) (void *handle
);
Function that returns the readability of the stream
gint64
(*Stream_Position) (void *handle
);
Function to query the current position in the stream
gint32 (*Stream_Read) (void *handle
,void *buffer
,gint32 offset
,gint32 count
);
Function to read data from the stream
void (*Stream_Write) (void *handle
,void *buffer
,gint32 offset
,gint32 count
);
Function to write data to the stream
void (*Stream_Seek) (void *handle
,gint64 offset
,WrapperSeekOrigin origin
);
Change the read or write position in the current stream
The orientation of an image is defined as the location of it's x,y origin. More than rotation, orientation allows for every variation of rotation, flips, and mirroring to be described in 3 bits of data.
A handy primer to orientation can be found at
http://jpegclub.org/exif_orientation.html
The orientation of the image is unknown |
||
The orientation of the image is without any rotation. |
||
The image is flipped on its horizontal axis |
||
The image is rotated by 180 degrees |
||
The Image is flipped on its vertical axis |
||
The image is rotated by 90 degrees clockwise and flipped on its horizontal axis |
||
The image is rotated by 90 degrees clockwise |
||
The image is rotated by 90 degrees clockwise and flipped on its vertical axis |
||
The image is rotated 270 degrees clockwise |
||
Options to control the format of the serialized XMP packet Taken from: exiv2/src/xmp.hpp
struct GExiv2Metadata;
An object holding all the Exiv2 metadata. Previews, if present, are also available.
As gexiv2 is only a wrapper around Exiv2, it's better to read its documentation to understand the full scope of what it offers: http://www.exiv2.org/
In particular, rather than providing a getter/setter method pair for every metadata value available for images (of which there are thousands), Exiv2 uses a dotted addressing scheme. For example, to access a photo's EXIF Orientation field, the caller passes to Exiv2 "Exif.Photo.Orientation". These tags (in Exiv2 parlance) are key to using Exiv2 (and therefore gexiv2) to its fullest.
A full reference for all supported Exiv2 tags can be found at
http://www.exiv2.org/metadata.htmltypedef struct { void *handle; Stream_CanSeek CanSeek; Stream_CanRead CanRead; Stream_CanWrite CanWrite; Stream_Length Length; Stream_Position Position; Stream_Read Read; Stream_Write Write; Stream_Seek Seek; Stream_Flush Flush; } ManagedStreamCallbacks;
ManagedStreamCallbacks is a set of callbacks that describe a stream that
can be passed to gexiv2_metadata_open_stream()
to read image meta-data from
arbitrary data sources that can be mapped to this set of callbacks.
At least CanSeek
and CanRead
need to return TRUE and the relevant
call-backs must not be NULL to be any useful.
void * |
Storage for the native handle to be used with this stream |
|
Stream_CanSeek |
Pointer to a function that describes the seekability of |
|
Stream_CanRead |
Pointer to a function that describes the readability of |
|
Stream_CanWrite |
Pointer to a function that describes the writability of |
|
Stream_Length |
Pointer to a function that gets the length of |
|
Stream_Position |
Pointer to a function that gives the current location inside |
|
Stream_Read |
Read bytes from the stream |
|
Stream_Write |
Function pointer to write to the stream. Can be NULL if |
[nullable] |
Stream_Seek |
Function pointer to seek in the stream. |
|
Stream_Flush |
Function pointer schedule writing of all cached data to disk. Can
be NULL if |
[nullable] |