From: Jan P. <pa...@pi...> - 2008-11-07 06:30:48
|
> On Thu, Nov 6, 2008 at 10:22 PM, Jan Patera <pa...@pi...> wrote: >>> Longitude = 89.00, 40.00, 11.16 >>> > (I would have expected a simple double printed though) Well, this is what libexif does: it simply prints 3 doubles because there are 3 values. > What I haven't worked out yet is how to set 3 rationals. > > entry_lon = exif_entry_new(); > exif_entry_initialize(entry_lon, EXIF_TAG_GPS_LONGITUDE); > > ExifRational value; > value.numerator = 54 > value.denominator = 1; > > exif_set_rational(entry_lon->data, exif_data_get_byte_order(ed), > value); > > exif_content_add_entry(ed->ifd[EXIF_IFD_GPS], entry_lon); > > exif_entry_unref(entry_lon); > > According to the spec there are 3 rationals. But I have no idea how to > do that with the API. > > May I ask for another pointer? :) Hmm, did you read my second mail? Check what exif_entry_initialize does for e.g. EXIF_TAG_EXIF_VERSION. You should either 1) adapt exif_entry_initialize so that it suports also GPS tags (currently it does not) 2) copy-past-adapt the code from exif_entry_initialize to your code: e->components = 3; // Use the correct number e->format = EXIF_FORMAT_xxxx; // Use correct format. RATIONAL? e->size = exif_format_get_size (e->format) * e->components; e->data = exif_entry_alloc (e, e->size); if (!e->data) fail; exif_set_rational(e->data, o, value1); exif_set_rational(e->data+sizeof(ExifRational), o, value2); exif_set_rational(e->data+2*sizeof(ExifRational), o, value3); -- Jan |