Merge with d8cd8e8947eceaf648ef570ea0eaaa518d6b3da7
This commit is contained in:
@@ -57,7 +57,7 @@ ImageData::ImageData (Glib::ustring fname, RawMetaDataLocation* ri) {
|
||||
extractInfo ();
|
||||
}
|
||||
}
|
||||
else if (dotpos<fname.size()-3 && !fname.casefold().compare (dotpos, 4, ".jpg")) {
|
||||
else if ((dotpos<fname.size()-3 && !fname.casefold().compare (dotpos, 4, ".jpg")) || (dotpos<fname.size()-4 && !fname.casefold().compare (dotpos, 5, ".jpeg"))) {
|
||||
FILE* f = safe_g_fopen (fname, "rb");
|
||||
if (f) {
|
||||
root = rtexif::ExifManager::parseJPEG (f);
|
||||
@@ -172,10 +172,22 @@ void ImageData::extractInfo () {
|
||||
focal_len = exif->getTag ("FocalLength")->toDouble ();
|
||||
if (exif->getTag ("FocalLengthIn35mmFilm"))
|
||||
focal_len35mm = exif->getTag ("FocalLengthIn35mmFilm")->toDouble ();
|
||||
rtexif::Tag* pDst=exif->getTag("SubjectDistance"); // EXIF, set by Adobe. MakerNote ones are scattered and partly encrypted
|
||||
|
||||
// Focus distance from EXIF or XMP. MakerNote ones are scattered and partly encrypted
|
||||
int num=-3, denom=-3;
|
||||
|
||||
// First try, offical EXIF. Set by Adobe on some DNGs
|
||||
rtexif::Tag* pDst=exif->getTag("SubjectDistance");
|
||||
if (pDst) {
|
||||
int num, denom;
|
||||
pDst->toRational(num,denom);
|
||||
} else {
|
||||
// Second try, XMP data
|
||||
char sXMPVal[64];
|
||||
if (root->getXMPTagValue("aux:ApproximateFocusDistance",sXMPVal)) { sscanf(sXMPVal,"%d/%d",&num,&denom); }
|
||||
}
|
||||
|
||||
if (num!=-3) {
|
||||
if ((denom==1 && num>=10000) || num<0 || denom<0)
|
||||
focus_dist=10000; // infinity
|
||||
else if (denom>0) {
|
||||
|
Reference in New Issue
Block a user