Home | History | Annotate | Download | only in examples

Lines Matching defs:exif

2  * write-exif.c
6 * Create a new EXIF data block and write it into a JPEG image file.
9 * to contain an EXIF tag block already, so it is easy to precompute where
10 * in the file the EXIF data should be. In real life, a library like
11 * libjpeg (included with the exif command-line tool source code) would
19 #include <libexif/exif-data.h>
22 #define FILE_NAME "write-exif.jpg"
111 /* raw EXIF header data */
118 /* byte order to use in the EXIF block */
121 /* comment to write into the EXIF block */
129 static ExifEntry *init_tag(ExifData *exif, ExifIfd ifd, ExifTag tag)
133 if (!((entry = exif_content_get_entry (exif->ifd[ifd], tag)))) {
141 exif_content_add_entry (exif->ifd[ifd], entry);
162 static ExifEntry *create_tag(ExifData *exif, ExifIfd ifd, ExifTag tag, size_t len)
187 exif_content_add_entry (exif->ifd[ifd], entry);
203 ExifData *exif = exif_data_new();
204 if (!exif) {
210 exif_data_set_option(exif, EXIF_DATA_OPTION_FOLLOW_SPECIFICATION);
211 exif_data_set_data_type(exif, EXIF_DATA_TYPE_COMPRESSED);
212 exif_data_set_byte_order(exif, FILE_BYTE_ORDER);
214 /* Create the mandatory EXIF fields with default data */
215 exif_data_fix(exif);
219 entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_PIXEL_X_DIMENSION);
222 entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_PIXEL_Y_DIMENSION);
225 entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_COLOR_SPACE);
233 entry = create_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_USER_COMMENT,
243 entry = create_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_AREA,
252 /* Get a pointer to the EXIF data block we just created */
253 exif_data_save_data(exif, &exif_data, &exif_data_len);
259 exif_data_unref(exif);
262 /* Write EXIF header */
267 /* Write EXIF block length in big-endian order */
276 /* Write EXIF data block */
281 /* Write JPEG image data, skipping the non-EXIF header */
298 exif_data_unref(exif);