Skip to content

Commit

Permalink
RAF: get actual sensor dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos authored and neheb committed Nov 24, 2023
1 parent 38adc8e commit f551534
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/rafimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ std::string RafImage::mimeType() const {
}

uint32_t RafImage::pixelWidth() const {
auto widthIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
if (pixelWidth_ != 0)
return pixelWidth_;

auto widthIter = exifData_.findKey(Exiv2::ExifKey("Exif.Fujifilm.RawImageFullWidth"));
if (widthIter == exifData_.end() || widthIter->count() == 0)
return 0;
return widthIter->toUint32();
}

uint32_t RafImage::pixelHeight() const {
auto heightIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension"));
if (pixelHeight_ != 0)
return pixelHeight_;

auto heightIter = exifData_.findKey(Exiv2::ExifKey("Exif.Fujifilm.RawImageFullHeight"));
if (heightIter == exifData_.end() || heightIter->count() == 0)
return 0;
return heightIter->toUint32();
Expand Down Expand Up @@ -319,6 +325,11 @@ void RafImage::readMetadata() {
exifData_["Exif.Image2.JPEGInterchangeFormat"] = getULong(jpg_img_offset, bigEndian);
exifData_["Exif.Image2.JPEGInterchangeFormatLength"] = getULong(jpg_img_length, bigEndian);

// Todo: parse the proprietary metadata structure
// at offset 92 for pixelWidth_ & pixelHeight_
// See https://libopenraw.freedesktop.org/formats/raf/
// and https://exiftool.org/TagNames/FujiFilm.html#RAF

// parse the tiff
byte readBuff[4];
if (io_->seek(100, BasicIo::beg) != 0)
Expand Down

0 comments on commit f551534

Please sign in to comment.