4 * Copyright (C) 2008 The Geeqie Team
7 * Support for Exif file format, originally written by Eric Swalens.
8 * Modified by Quy Tonthat
9 * Reimplemented with generic data storage by John Ellis
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #define EXIF_FORMATTED(x) "formatted."x
31 #define EXIF_FORMATTED_LEN (sizeof(EXIF_FORMATTED()) - 1)
34 *-----------------------------------------------------------------------------
36 *-----------------------------------------------------------------------------
39 #define EXIF_FORMAT_COUNT 13
42 EXIF_FORMAT_UNKNOWN = 0,
43 EXIF_FORMAT_BYTE_UNSIGNED = 1,
44 EXIF_FORMAT_STRING = 2,
45 EXIF_FORMAT_SHORT_UNSIGNED = 3,
46 EXIF_FORMAT_LONG_UNSIGNED = 4,
47 EXIF_FORMAT_RATIONAL_UNSIGNED = 5,
49 EXIF_FORMAT_UNDEFINED = 7,
50 EXIF_FORMAT_SHORT = 8,
52 EXIF_FORMAT_RATIONAL = 10,
53 EXIF_FORMAT_FLOAT = 11,
54 EXIF_FORMAT_DOUBLE = 12
59 *-----------------------------------------------------------------------------
61 *-----------------------------------------------------------------------------
64 typedef struct _ExifItem ExifItem;
66 typedef struct _ExifRational ExifRational;
74 /* enums useful for image manipulation */
77 EXIF_ORIENTATION_UNKNOWN = 0,
78 EXIF_ORIENTATION_TOP_LEFT = 1,
79 EXIF_ORIENTATION_TOP_RIGHT = 2,
80 EXIF_ORIENTATION_BOTTOM_RIGHT = 3,
81 EXIF_ORIENTATION_BOTTOM_LEFT = 4,
82 EXIF_ORIENTATION_LEFT_TOP = 5,
83 EXIF_ORIENTATION_RIGHT_TOP = 6,
84 EXIF_ORIENTATION_RIGHT_BOTTOM = 7,
85 EXIF_ORIENTATION_LEFT_BOTTOM = 8
86 } ExifOrientationType;
89 EXIF_UNIT_UNKNOWN = 0,
92 EXIF_UNIT_CENTIMETER = 3
96 typedef struct _ExifFormattedText ExifFormattedText;
97 struct _ExifFormattedText
100 const gchar *description;
101 gchar *(*build_func)(ExifData *exif);
105 *-----------------------------------------------------------------------------
107 *-----------------------------------------------------------------------------
110 ExifData *exif_read(gchar *path, gchar *sidecar_path, GHashTable *modified_xmp);
112 ExifData *exif_read_fd(FileData *fd);
113 void exif_free_fd(FileData *fd, ExifData *exif);
114 gint exif_write_fd(FileData *fd);
116 /* exif_read returns processed data (merged from image and sidecar, etc.)
117 this function gives access to the original data from the image.
118 original data are part of the processed data and should not be freed separately */
119 ExifData *exif_get_original(ExifData *processed);
121 gint exif_write(ExifData *exif);
122 void exif_free(ExifData *exif);
124 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key);
125 gint exif_get_integer(ExifData *exif, const gchar *key, gint *value);
126 ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign);
128 ExifItem *exif_get_item(ExifData *exif, const gchar *key);
129 ExifItem *exif_get_first_item(ExifData *exif);
130 ExifItem *exif_get_next_item(ExifData *exif);
133 gchar *exif_item_get_tag_name(ExifItem *item);
134 guint exif_item_get_tag_id(ExifItem *item);
135 guint exif_item_get_elements(ExifItem *item);
136 gchar *exif_item_get_data(ExifItem *item, guint *data_len);
137 gchar *exif_item_get_description(ExifItem *item);
138 guint exif_item_get_format_id(ExifItem *item);
139 const gchar *exif_item_get_format_name(ExifItem *item, gint brief);
140 gchar *exif_item_get_data_as_text(ExifItem *item);
141 gint exif_item_get_integer(ExifItem *item, gint *value);
142 ExifRational *exif_item_get_rational(ExifItem *item, gint *sign, guint n);
144 gchar *exif_item_get_string(ExifItem *item, gint idx);
146 gchar *exif_get_description_by_key(const gchar *key);
147 gchar *exif_get_tag_description_by_key(const gchar *key);
149 gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint *key_valid);
151 gint exif_update_metadata(ExifData *exif, const gchar *key, const GList *values);
153 guchar *exif_get_color_profile(ExifData *exif, guint *data_len);
155 /* jpeg embedded icc support */
157 void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length);
160 gint exif_jpeg_segment_find(guchar *data, guint size,
161 guchar app_marker, const gchar *magic, guint magic_len,
162 guint *seg_offset, guint *seg_length);
163 gint exif_jpeg_parse_color(ExifData *exif, guchar *data, guint size);
166 guchar *exif_get_preview(ExifData *exif, guint *data_len, gint requested_width, gint requested_height);
167 void exif_free_preview(guchar *buf);
171 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */