summaryrefslogtreecommitdiff
path: root/src/jpeg-utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jpeg-utils.cpp')
-rw-r--r--src/jpeg-utils.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/jpeg-utils.cpp b/src/jpeg-utils.cpp
index 6c652a5..5a32a3a 100644
--- a/src/jpeg-utils.cpp
+++ b/src/jpeg-utils.cpp
@@ -225,7 +225,16 @@ get_exif_data_fixed (ExifData *exif, const gchar *key)
return NULL;
if (g_str_equal (key, EXIF_APERTURE)) {
- float val = exifData["Exif.Photo.FNumber"].toFloat();
+ double val = -1;
+ if (exif->fake_aperture != -1)
+ val = exif->fake_aperture;
+ else {
+ if (exifData["Exif.Photo.FNumber"].count() > 0)
+ val = exifData["Exif.Photo.FNumber"].toFloat();
+ else
+ if (exifData["Exif.Photo.ApertureValue"].count() > 0)
+ val = exifData["Exif.Photo.ApertureValue"].toFloat();
+ }
if (val >= 0)
return g_strdup_printf ("f/%.1f", val);
}
@@ -297,7 +306,8 @@ get_exif_data_fixed (ExifData *exif, const gchar *key)
}
if (g_str_equal (key, EXIF_FOCAL_LENGTH)) {
- float val = exifData["Exif.Photo.FocalLength"].toFloat();
+ double val;
+ val = exif->fake_focal_length != -1 ? exif->fake_focal_length : exifData["Exif.Photo.FocalLength"].toFloat();
if (val >= 0)
return g_strdup_printf ("%.0f mm", val);
}
@@ -754,6 +764,22 @@ modify_exif (const gchar *filename, ExifData *exif, gboolean strip_thumbnail, gb
modified = TRUE;
}
}
+
+ if (exif->fake_aperture != -1) {
+ if (! exifData.empty()) {
+ exifData["Exif.Photo.FNumber"] = Exiv2::floatToRationalCast (exif->fake_aperture);
+ if (exifData["Exif.Photo.ApertureValue"].count() > 0)
+ exifData["Exif.Photo.ApertureValue"] = Exiv2::floatToRationalCast (exif->fake_aperture);
+ modified = TRUE;
+ }
+ }
+
+ if (exif->fake_focal_length != -1) {
+ if (! exifData.empty()) {
+ exifData["Exif.Photo.FocalLength"] = Exiv2::floatToRationalCast (exif->fake_focal_length);
+ modified = TRUE;
+ }
+ }
}