6 * Support for Exif file format, originally written by Eric Swalens.
7 * Modified by Quy Tonthat
8 * Reimplemented with generic data storage by John Ellis
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 *-----------------------------------------------------------------------------
33 *-----------------------------------------------------------------------------
37 EXIF_FORMAT_UNKNOWN = 0,
38 EXIF_FORMAT_BYTE_UNSIGNED = 1,
39 EXIF_FORMAT_STRING = 2,
40 EXIF_FORMAT_SHORT_UNSIGNED = 3,
41 EXIF_FORMAT_LONG_UNSIGNED = 4,
42 EXIF_FORMAT_RATIONAL_UNSIGNED = 5,
44 EXIF_FORMAT_UNDEFINED = 7,
45 EXIF_FORMAT_SHORT = 8,
47 EXIF_FORMAT_RATIONAL = 10,
48 EXIF_FORMAT_FLOAT = 11,
49 EXIF_FORMAT_DOUBLE = 12
52 typedef struct _ExifFormatAttrib ExifFormatAttrib;
53 struct _ExifFormatAttrib
57 const char *short_name;
58 const char *description;
61 /* the list of known tag data formats */
62 extern ExifFormatAttrib ExifFormatList[];
66 *-----------------------------------------------------------------------------
68 *-----------------------------------------------------------------------------
71 typedef struct _ExifData ExifData;
74 GList *items; /* list of (ExifItem *) */
77 typedef struct _ExifRational ExifRational;
80 unsigned long int num;
81 unsigned long int den;
85 typedef struct _ExifItem ExifItem;
86 typedef struct _ExifMarker ExifMarker;
87 typedef struct _ExifTextList ExifTextList;
91 ExifFormatType format;
102 ExifFormatType format;
112 const char* description;
116 typedef struct _ExifFormattedText ExifFormattedText;
117 struct _ExifFormattedText
120 const char *description;
125 *-----------------------------------------------------------------------------
127 *-----------------------------------------------------------------------------
130 /* enums useful for image manipulation */
133 EXIF_ORIENTATION_UNKNOWN = 0,
134 EXIF_ORIENTATION_TOP_LEFT = 1,
135 EXIF_ORIENTATION_TOP_RIGHT = 2,
136 EXIF_ORIENTATION_BOTTOM_RIGHT = 3,
137 EXIF_ORIENTATION_BOTTOM_LEFT = 4,
138 EXIF_ORIENTATION_LEFT_TOP = 5,
139 EXIF_ORIENTATION_RIGHT_TOP = 6,
140 EXIF_ORIENTATION_RIGHT_BOTTOM = 7,
141 EXIF_ORIENTATION_LEFT_BOTTOM = 8
142 } ExifOrientationType;
145 EXIF_UNIT_UNKNOWN = 0,
146 EXIF_UNIT_NOUNIT = 1,
148 EXIF_UNIT_CENTIMETER = 3
152 /* the known exif tags list */
153 extern ExifMarker ExifKnownMarkersList[];
155 /* the unknown tags utilize this generic list */
156 extern ExifMarker ExifUnknownMarkersList[];
158 /* the list of specially formatted keys, for human readable output */
159 extern ExifFormattedText ExifFormattedList[];
163 *-----------------------------------------------------------------------------
165 *-----------------------------------------------------------------------------
168 ExifData *exif_read(const gchar *path);
169 void exif_free(ExifData *exif);
171 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key);
172 gint exif_get_integer(ExifData *exif, const gchar *key, gint *value);
173 ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign);
174 double exif_rational_to_double(ExifRational *r, gint sign);
176 ExifItem *exif_get_item(ExifData *exif, const gchar *key);
178 const char *exif_item_get_tag_name(ExifItem *item);
179 const char *exif_item_get_description(ExifItem *item);
180 const char *exif_item_get_format_name(ExifItem *item, gint brief);
181 gchar *exif_item_get_data_as_text(ExifItem *item);
182 gint exif_item_get_integer(ExifItem *item, gint *value);
183 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign);
185 const gchar *exif_get_description_by_key(const gchar *key);
187 /* usually for debugging to stdout */
188 void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list);