From 5159de89cbb113e51dbeda546294f7cb5b65a6ab Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Thu, 13 Jun 2024 09:42:15 +0200 Subject: [PATCH] imagedata: report if file is DNG --- rtengine/imagedata.cc | 7 +++++++ rtengine/imagedata.h | 2 ++ rtengine/rtengine.h | 2 ++ rtgui/cacheimagedata.cc | 6 ++++++ rtgui/cacheimagedata.h | 2 ++ 5 files changed, 19 insertions(+) diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index 6507a970d..45db99f1e 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -565,6 +565,8 @@ FramesData::FramesData(const Glib::ustring &fname, time_t ts) : meta.getDimensions(w_, h_); + isDNG = find_exif_tag("Exif.Image.DNGVersion"); + // ----------------------- // Special file type detection (HDR, PixelShift) // ------------------------ @@ -778,6 +780,11 @@ bool FramesData::getHDR() const return isHDR; } +bool FramesData::getDNG() const +{ + return isDNG; +} + std::string FramesData::getImageType() const { return isPixelShift ? "PS" : isHDR ? "HDR" : "STD"; diff --git a/rtengine/imagedata.h b/rtengine/imagedata.h index 08f55bd62..f999d59e6 100644 --- a/rtengine/imagedata.h +++ b/rtengine/imagedata.h @@ -59,6 +59,7 @@ private: time_t modTimeStamp; bool isPixelShift; bool isHDR; + bool isDNG; int w_; int h_; @@ -69,6 +70,7 @@ public: unsigned int getFrameCount() const override; bool getPixelShift() const override; bool getHDR() const override; + bool getDNG() const override; std::string getImageType() const override; IIOSampleFormat getSampleFormat() const override; bool hasExif() const override; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index f1ee4108c..0010f42b8 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -130,6 +130,8 @@ public: virtual bool getPixelShift () const = 0; /** @return false: not an HDR file ; true: single or multi-frame HDR file (e.g. Pentax HDR raw file or 32 bit float DNG file or Log compressed) */ virtual bool getHDR() const = 0; + /** @return true if the file is a DNG file */ + virtual bool getDNG() const = 0; /** @return false: not an HDR file ; true: single or multi-frame HDR file (e.g. Pentax HDR raw file or 32 bit float DNG file or Log compressed) */ virtual std::string getImageType() const = 0; diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index 0e9cc7f0f..872c60504 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -59,6 +59,7 @@ CacheImageData::CacheImageData() : iso(0), rating(0), isHDR (false), + isDNG (false), isPixelShift (false), sensortype(rtengine::ST_NONE), sampleFormat(rtengine::IIOSF_UNKNOWN), @@ -194,6 +195,10 @@ int CacheImageData::load (const Glib::ustring& fname) isHDR = keyFile.get_boolean ("ExifInfo", "IsHDR"); } + if (keyFile.has_key ("ExifInfo", "IsDNG")) { + isDNG = keyFile.get_boolean ("ExifInfo", "IsDNG"); + } + if (keyFile.has_key ("ExifInfo", "IsPixelShift")) { isPixelShift = keyFile.get_boolean ("ExifInfo", "IsPixelShift"); } @@ -316,6 +321,7 @@ int CacheImageData::save (const Glib::ustring& fname) keyFile.set_double ("ExifInfo", "FocusDist", focusDist); keyFile.set_integer ("ExifInfo", "ISO", iso); keyFile.set_boolean ("ExifInfo", "IsHDR", isHDR); + keyFile.set_boolean ("ExifInfo", "IsDNG", isDNG); keyFile.set_boolean ("ExifInfo", "IsPixelShift", isPixelShift); keyFile.set_string ("ExifInfo", "ExpComp", expcomp); } diff --git a/rtgui/cacheimagedata.h b/rtgui/cacheimagedata.h index 8c0fa6513..e3d5cc3da 100644 --- a/rtgui/cacheimagedata.h +++ b/rtgui/cacheimagedata.h @@ -60,6 +60,7 @@ public: unsigned iso; int rating; bool isHDR; + bool isDNG; bool isPixelShift; int sensortype; rtengine::IIO_Sample_Format sampleFormat; @@ -114,6 +115,7 @@ public: int getRating () const override { return rating; } // FIXME-piotr : missing rating bool getPixelShift () const override { return isPixelShift; } bool getHDR() const override { return isHDR; } + bool getDNG() const override { return isDNG; } std::string getImageType() const override { return isPixelShift ? "PS" : isHDR ? "HDR" : "STD"; } rtengine::IIOSampleFormat getSampleFormat() const override { return sampleFormat; } void getDimensions(int &w, int &h) const override