|
@@ -210,12 +210,6 @@ create_exif(struct Imagedata data)
|
|
|
entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_FNUMBER);
|
|
|
exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, rational);
|
|
|
|
|
|
- // aperture
|
|
|
- rational.numerator = (long) ((double) data.aperture * denominator);
|
|
|
- rational.denominator = denominator;
|
|
|
- entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_APERTURE_VALUE);
|
|
|
- exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, rational);
|
|
|
-
|
|
|
// focal length
|
|
|
rational.numerator = (long) ((double) data.focal_length * denominator);
|
|
|
rational.denominator = denominator;
|
|
@@ -223,13 +217,11 @@ create_exif(struct Imagedata data)
|
|
|
exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, rational);
|
|
|
|
|
|
// focal length, 35mm equiv
|
|
|
- rational.numerator = (long) ((double) data.focal_length_35mm * denominator);
|
|
|
- rational.denominator = denominator;
|
|
|
entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM);
|
|
|
- exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, rational);
|
|
|
+ exif_set_short(entry->data, EXIF_BYTE_ORDER_INTEL, data.focal_length_35mm);
|
|
|
|
|
|
// ISO
|
|
|
- entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_ISO_SPEED);
|
|
|
+ entry = init_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_ISO_SPEED_RATINGS);
|
|
|
exif_set_long(entry->data, EXIF_BYTE_ORDER_INTEL, data.isospeed);
|
|
|
|
|
|
// Flash
|
|
@@ -245,6 +237,8 @@ read_exif(char *filename)
|
|
|
uint16_t subifd_count;
|
|
|
uint32_t *subifd_offsets;
|
|
|
uint32_t exif_offset;
|
|
|
+ uint32_t value_count;
|
|
|
+ uint16_t *short_array;
|
|
|
char *temp;
|
|
|
|
|
|
TIFF *im = TIFFOpen(filename, "r");
|
|
@@ -311,18 +305,15 @@ read_exif(char *filename)
|
|
|
err("failed to read EXIFTAG_EXPOSURETIME");
|
|
|
}
|
|
|
|
|
|
- if (TIFFGetField(im, EXIFTAG_ISOSPEED, &imagedata.isospeed) != 1) {
|
|
|
- err("failed to read EXIFTAG_ISOSPEED");
|
|
|
+ if (TIFFGetField(im, EXIFTAG_PHOTOGRAPHICSENSITIVITY, &value_count, &short_array) != 1) {
|
|
|
+ err("failed to read EXIFTAG_PHOTOGRAPHICSENSITIVITY");
|
|
|
}
|
|
|
+ imagedata.isospeed = short_array[0];
|
|
|
|
|
|
if (TIFFGetField(im, EXIFTAG_FNUMBER, &imagedata.fnumber) != 1) {
|
|
|
err("failed to read EXIFTAG_FNUMBER");
|
|
|
}
|
|
|
|
|
|
- if (TIFFGetField(im, EXIFTAG_APERTUREVALUE, &imagedata.aperture) != 1) {
|
|
|
- err("failed to read EXIFTAG_APERTUREVALUE");
|
|
|
- }
|
|
|
-
|
|
|
if (TIFFGetField(im, EXIFTAG_FOCALLENGTH, &imagedata.focal_length) != 1) {
|
|
|
err("failed to read EXIFTAG_FOCALLENGTH");
|
|
|
}
|