3 * Copyright © 2002 Lutz Müller <lutz@users.sourceforge.net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA.
23 #include <libexif/exif-data.h>
24 #include <libexif/exif-ifd.h>
25 #include <libexif/exif-loader.h>
35 unsigned char *eb
, size
[2];
40 printf ("Creating EXIF data...\n");
41 ed
= exif_data_new ();
42 exif_data_set_data_type (ed
, EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY
);
44 printf ("Fill EXIF data with all necessary entries to follow specs...\n");
49 printf ("Saving EXIF data to memory...\n");
50 exif_data_save_data (ed
, &eb
, &ebs
);
53 printf ("Writing %i byte(s) EXIF data to loader...\n", ebs
);
54 loader
= exif_loader_new ();
55 size
[0] = (unsigned char) ebs
;
56 size
[1] = (unsigned char) (ebs
>> 8);
57 exif_loader_write (loader
, size
, 2);
58 for (i
= 0; i
< ebs
&& exif_loader_write (loader
, eb
+ i
, 1); i
++);
59 printf ("Wrote %i byte(s).\n", i
);
61 ed
= exif_loader_get_data (loader
);
62 exif_loader_unref (loader
);