Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[imageio] [DAM] Fix crop factor calculation for many Fujifilm cameras #15587

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/common/exif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,8 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
// We are entering the zoo of image dimensions metadata.
// Let's first try the DNG way of telling dimensions.
// Exif.Image.ImageWidth/Length tags are also present in DNG files,
// but contain the dimensions of the preview image.
// but contain the pixel dimensions of the preview image, which in
// this case will cause the diagonal calculation to be incorrect.
if(FIND_EXIF_TAG("Exif.SubImage1.NewSubfileType"))
{
if(pos->toLong() == 0) // Primary image
Expand All @@ -1199,18 +1200,19 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
image_height = pos->toLong();
}
}
// If there are no such tags, then, try Fuji way.
// For Fuji raws, the following tags are the only ones that
// contain dimensions of the full image from the sensor.
if(image_width == 0)
// For Fuji cameras, we intentionally get the pixel dimensions
// of the preview, not the sensor, because that's what the data
// in the resolution tags on most Fuji cameras is calculated for.
if(image_width == 0 && !strcmp(img->exif_maker, "FUJIFILM"))
{
if(FIND_EXIF_TAG("Exif.Fujifilm.RawImageFullWidth"))
if(FIND_EXIF_TAG("Exif.Photo.PixelXDimension"))
image_width = pos->toLong();
if(FIND_EXIF_TAG("Exif.Fujifilm.RawImageFullHeight"))
if(FIND_EXIF_TAG("Exif.Photo.PixelYDimension"))
image_height = pos->toLong();
}
// The following tags in certain formats may contain dimensions of
// the preview instead of the full image, so we check them last.
// The following tags in certain formats may contain pixel dimensions of
// the preview instead of the full image, while resolution is calculated
// relative to the full image dimensions. So we check them last.
if(image_width == 0)
{
if(FIND_EXIF_TAG("Exif.Image.ImageWidth"))
Expand Down