Skip to content

Commit 325de01

Browse files
victoryforceTurboGit
authored andcommitted
Fixed crop factor calculation for many Fujifilm cameras
1 parent 4d4b8e9 commit 325de01

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/common/exif.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,8 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
11881188
// We are entering the zoo of image dimensions metadata.
11891189
// Let's first try the DNG way of telling dimensions.
11901190
// Exif.Image.ImageWidth/Length tags are also present in DNG files,
1191-
// but contain the dimensions of the preview image.
1191+
// but contain the pixel dimensions of the preview image, which in
1192+
// this case will cause the diagonal calculation to be incorrect.
11921193
if(FIND_EXIF_TAG("Exif.SubImage1.NewSubfileType"))
11931194
{
11941195
if(pos->toLong() == 0) // Primary image
@@ -1199,18 +1200,19 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
11991200
image_height = pos->toLong();
12001201
}
12011202
}
1202-
// If there are no such tags, then, try Fuji way.
1203-
// For Fuji raws, the following tags are the only ones that
1204-
// contain dimensions of the full image from the sensor.
1205-
if(image_width == 0)
1203+
// For Fuji cameras, we intentionally get the pixel dimensions
1204+
// of the preview, not the sensor, because that's what the data
1205+
// in the resolution tags on most Fuji cameras is calculated for.
1206+
if(image_width == 0 && !strcmp(img->exif_maker, "FUJIFILM"))
12061207
{
1207-
if(FIND_EXIF_TAG("Exif.Fujifilm.RawImageFullWidth"))
1208+
if(FIND_EXIF_TAG("Exif.Photo.PixelXDimension"))
12081209
image_width = pos->toLong();
1209-
if(FIND_EXIF_TAG("Exif.Fujifilm.RawImageFullHeight"))
1210+
if(FIND_EXIF_TAG("Exif.Photo.PixelYDimension"))
12101211
image_height = pos->toLong();
12111212
}
1212-
// The following tags in certain formats may contain dimensions of
1213-
// the preview instead of the full image, so we check them last.
1213+
// The following tags in certain formats may contain pixel dimensions of
1214+
// the preview instead of the full image, while resolution is calculated
1215+
// relative to the full image dimensions. So we check them last.
12141216
if(image_width == 0)
12151217
{
12161218
if(FIND_EXIF_TAG("Exif.Image.ImageWidth"))

0 commit comments

Comments
 (0)