diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2012-04-15 21:44:31 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2012-04-15 21:44:31 +0200 |
| commit | 713c2d86d9335a9c681357254d4bc4f817626259 (patch) | |
| tree | c4cabe1b7dcf1d2f192fdcfc68d35e242305c949 /src/jpeg-utils.h | |
| parent | c5f23c17a14bbe07042f46be90fe2b2e465436c7 (diff) | |
| download | cataract-713c2d86d9335a9c681357254d4bc4f817626259.tar.xz | |
Change EXIF metadata handling into a registered function
This allows much greater flexibility from templates regarding
EXIF metadata handling, no more hardcoded symbols. It's possible
to display essentially any attribute known to Exiv2. Please see
http://exiv2.org/metadata.html
This brings two new functions that can be called from templates:
* get_exif_value (exiv2_attribute)
* get_exif_value_fixed (exiv2_attribute)
Both functions take a string argument of metadata attribute name
from Exiv2 namespace. The difference is that get_exif_value_fixed()
does some extra formatting for several basic attributes
(e.g. datetime format).
Diffstat (limited to 'src/jpeg-utils.h')
| -rw-r--r-- | src/jpeg-utils.h | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/src/jpeg-utils.h b/src/jpeg-utils.h index a682fd1..05a6a49 100644 --- a/src/jpeg-utils.h +++ b/src/jpeg-utils.h @@ -26,43 +26,41 @@ G_BEGIN_DECLS #define SQUARED_SIMPLE_SHAVE_AMOUNT 5 /* percent */ - -/* TODO: we want to have numerical values here at some point in the future */ -typedef struct { - gchar *datetime; - gchar *camera_model; - gchar *iso; - gchar *focal_length; - gchar *focal_length_35mm; - gchar *aperture; - gchar *exposure; - gchar *flash; - - gchar *exif_software; - gchar *exif_imgdesc; - gchar *exif_artist; - gchar *exif_copyright; - gchar *exif_usercomment; - - gchar *iptc_objectname; - gchar *iptc_copyright; - gchar *iptc_credit; - gchar *iptc_caption; - gchar *iptc_author; - - gchar *jpeg_comment; -} TExifData; +/* EXIF data known keys */ +#define EXIF_APERTURE "Exif.Photo.FNumber" +#define EXIF_CAMERA_MODEL "Exif.Image.Model" +#define EXIF_DATETIME "Exif.Photo.DateTimeOriginal" +#define EXIF_EXPOSURE "Exif.Photo.ExposureTime" +#define EXIF_FLASH "Exif.Photo.Flash" +#define EXIF_FOCAL_LENGTH "Exif.Photo.FocalLength" +#define EXIF_ISO "Exif.Photo.ISOSpeedRatings" +#define EXIF_IMAGE_DESCRIPTION "Exif.Image.ImageDescription" +#define EXIF_ARTIST "Exif.Image.Artist" +#define EXIF_COPYRIGHT "Exif.Image.Copyright" +#define EXIF_COMMENT "Exif.Photo.UserComment" +#define IPTC_COPYRIGHT "Iptc.Application2.Copyright" +#define IPTC_CAPTION "Iptc.Application2.Caption" +#define IPTC_AUTHOR "Iptc.Application2.Byline" +#define JPEG_COMMENT "Jpeg.Comment" + + +typedef struct ExifData ExifData; /* - * get_exif: retrieve EXIF info from a JPEG image + * EXIF and IPTC info retrieval, keeps the source file open until freed */ -TExifData * get_exif (const gchar *filename); +ExifData * read_exif (const gchar *filename); +void exif_data_free (ExifData *data); /* - * free_exif_struct: free allocated structure + * Retrieves the value of the specified key or NULL if the key does not exist. + * The key argument belongs to Exiv2 namespace - see http://exiv2.org/tags.html + * + * The get_exif_data_fixed() function does some pretty printing for selected keys. */ -void free_exif_data (TExifData *data); +gchar * get_exif_data (ExifData *exif, const gchar *key); +gchar * get_exif_data_fixed (ExifData *exif, const gchar *key); /* |
