Rawtherapee: Exif data on Canon D30 and 300D cannot be read

Created on 29 Sep 2018  ·  12Comments  ·  Source: Beep6581/RawTherapee

As per this mention: https://discuss.pixls.us/t/old-models-of-canon/9219/2
It seems the exif info of raw files from the Canon 30D and 300D cannot be read by RT. I was able to reproduce on the latest dev build.

FWIW: Also my default picture viewer IrfanView cannot read the Exif info.

patch provided metadata bug

All 12 comments

The _D30_ CRW

$ exiv2 -p a ~/Downloads/'Canon - EOS D30 - RAW (3_2).CRW' 
Exif.Photo.PixelXDimension                   Long        1  2160
Exif.Photo.PixelYDimension                   Long        1  1440
Exif.Image.Orientation                       Short       1  top, left
Exif.Canon.FileNumber                        Long        1  224-2444
Exif.Photo.DateTimeOriginal                  Ascii      20  2016:12:23 17:05:30
Exif.Canon.ImageType                         Ascii      27  CRW:EOS D30 CMOS RAW IMAGE
Exif.Canon.OwnerName                         Ascii       1  
Exif.Image.Make                              Ascii       6  Canon
Exif.Image.Model                             Ascii      14  Canon EOS D30
Exif.Canon.SerialNumber                      Long        2  172700170
Exif.Canon.FirmwareVersion                   Ascii      22  Firmware Version 1.02
Exif.Canon.FocalLength                       Short       4  50.0 mm
Exif.CanonSi.ISOSpeed                        Short       1  1600
Exif.CanonSi.MeasuredEV                      Short       1  3.38
Exif.CanonSi.TargetAperture                  Short       1  F1.4
Exif.CanonSi.TargetShutterSpeed              Short       1  1/50 s
Exif.CanonSi.WhiteBalance                    Short       1  Auto
Exif.CanonSi.Sequence                        Short       1  1
Exif.CanonSi.AFPointUsed                     Short       1  3 focus points; center used
Exif.CanonSi.FlashBias                       Short       1  0 EV
Exif.CanonSi.SubjectDistance                 Short       1  0 m
Exif.CanonSi.ApertureValue                   Short       1  F1.4
Exif.CanonSi.ShutterSpeedValue               Short       1  1/51 s
Exif.CanonSi.MeasuredEV2                     Short       1  3.38
Exif.Photo.FNumber                           Rational    1  F1.4
Exif.Photo.ExposureTime                      Rational    1  1/51 s
Exif.CanonCs.Macro                           Short       1  Off
Exif.CanonCs.Selftimer                       Short       1  Off
Exif.CanonCs.Quality                         Short       1  RAW
Exif.CanonCs.FlashMode                       Short       1  Off
Exif.CanonCs.DriveMode                       Short       1  Continuous
Exif.CanonCs.FocusMode                       Short       1  One shot AF
Exif.CanonCs.ImageSize                       Short       1  Large
Exif.CanonCs.EasyMode                        Short       1  Manual
Exif.CanonCs.DigitalZoom                     Short       1  None
Exif.CanonCs.Contrast                        Short       1  Normal
Exif.CanonCs.Saturation                      Short       1  Normal
Exif.CanonCs.Sharpness                       Short       1  Normal
Exif.CanonCs.ISOSpeed                        Short       1  n/a
Exif.CanonCs.MeteringMode                    Short       1  Center-weighted average
Exif.CanonCs.FocusType                       Short       1  Not known
Exif.CanonCs.AFPoint                         Short       1  Center
Exif.CanonCs.ExposureProgram                 Short       1  Manual (M)
Exif.CanonCs.LensType                        Short       1  Canon EF 50mm f/1.4 USM
Exif.CanonCs.Lens                            Short       3  50.0 mm
Exif.CanonCs.MaxAperture                     Short       1  F1.4
Exif.CanonCs.MinAperture                     Short       1  F22
Exif.CanonCs.FlashActivity                   Short       1  (255)
Exif.CanonCs.FlashDetails                    Short       1  
Exif.CanonCf.NoiseReduction                  Short       1  256
Exif.CanonCf.ShutterAeLock                   Short       1  514
Exif.CanonCf.MirrorLockup                    Short       1  768
Exif.CanonCf.ExposureLevelIncrements         Short       1  1025
Exif.CanonCf.AFAssist                        Short       1  1280
Exif.CanonCf.FlashSyncSpeedAv                Short       1  1536
Exif.CanonCf.AEBSequence                     Short       1  1794
Exif.CanonCf.ShutterCurtainSync              Short       1  2049
Exif.CanonCf.LensAFStopButton                Short       1  2305
Exif.CanonCf.FillFlashAutoReduction          Short       1  2560
Exif.CanonCf.MenuButtonReturn                Short       1  2816
Exif.CanonCf.SetButtonFunction               Short       1  3074
Exif.CanonCf.SensorCleaning                  Short       1  3328
Exif.Image2.JPEGInterchangeFormat            Long        1  2824674
Exif.Image2.JPEGInterchangeFormatLength      Long        1  164136

and the 300D CRW

$ exiv2 -p a ~/Downloads/'Canon - EOS 300D - RAW (3_2).crw' 
Exif.Photo.PixelXDimension                   Long        1  3072
Exif.Photo.PixelYDimension                   Long        1  2048
Exif.Image.Orientation                       Short       1  left, bottom
Exif.Canon.FileNumber                        Long        1  103-0333
Exif.Photo.DateTimeOriginal                  Ascii      20  2004:05:01 10:43:58
Exif.Canon.ImageType                         Ascii      30  CRW:EOS 300D DIGITAL CMOS RAW
Exif.Canon.OwnerName                         Ascii       1  
Exif.Image.Make                              Ascii       6  Canon
Exif.Image.Model                             Ascii      23  Canon EOS 300D DIGITAL
Exif.Canon.SerialNumber                      Long        2  3d6b00473
Exif.Canon.FirmwareVersion                   Ascii      23  Firmware Version 1.1.1
Exif.Canon.FocalLength                       Short       4  70.0 mm
Exif.CanonSi.ISOSpeed                        Short       1  100
Exif.CanonSi.MeasuredEV                      Short       1  14.00
Exif.CanonSi.TargetAperture                  Short       1  F14
Exif.CanonSi.TargetShutterSpeed              Short       1  1/79 s
Exif.CanonSi.WhiteBalance                    Short       1  Auto
Exif.CanonSi.Sequence                        Short       1  0
Exif.CanonSi.AFPointUsed                     Short       1  0 focus points; none used
Exif.CanonSi.FlashBias                       Short       1  0 EV
Exif.CanonSi.SubjectDistance                 Short       1  0 m
Exif.CanonSi.ApertureValue                   Short       1  F14
Exif.CanonSi.ShutterSpeedValue               Short       1  1/81 s
Exif.CanonSi.MeasuredEV2                     Short       1  14.12
Exif.Photo.FNumber                           Rational    1  F14
Exif.Photo.ExposureTime                      Rational    1  1/81 s
Exif.CanonCs.Macro                           Short       1  (0)
Exif.CanonCs.Selftimer                       Short       1  Off
Exif.CanonCs.Quality                         Short       1  RAW
Exif.CanonCs.FlashMode                       Short       1  Off
Exif.CanonCs.DriveMode                       Short       1  Continuous
Exif.CanonCs.FocusMode                       Short       1  AI focus AF
Exif.CanonCs.ImageSize                       Short       1  Large
Exif.CanonCs.EasyMode                        Short       1  Manual
Exif.CanonCs.DigitalZoom                     Short       1  (65535)
Exif.CanonCs.Contrast                        Short       1  High
Exif.CanonCs.Saturation                      Short       1  High
Exif.CanonCs.Sharpness                       Short       1  High
Exif.CanonCs.ISOSpeed                        Short       1  n/a
Exif.CanonCs.MeteringMode                    Short       1  Evaluative
Exif.CanonCs.FocusType                       Short       1  Not known
Exif.CanonCs.AFPoint                         Short       1  Manual AF point selection
Exif.CanonCs.ExposureProgram                 Short       1  Aperture priority (Av)
Exif.CanonCs.LensType                        Short       1  n/a
Exif.CanonCs.Lens                            Short       3  35.0 - 70.0 mm
Exif.CanonCs.MaxAperture                     Short       1  F4
Exif.CanonCs.MinAperture                     Short       1  F27
Exif.CanonCs.FlashActivity                   Short       1  Did not fire
Exif.CanonCs.FlashDetails                    Short       1  
Exif.CanonCs.FocusContinuous                 Short       1  (65535)
Exif.CanonCs.AESetting                       Short       1  (65535)
Exif.CanonCs.ImageStabilization              Short       1  (65535)
Exif.CanonCs.DisplayAperture                 Short       1  0
Exif.CanonCs.ZoomSourceWidth                 Short       1  3072
Exif.CanonCs.ZoomTargetWidth                 Short       1  3072
Exif.CanonCs.SpotMeteringMode                Short       1  (65535)
Exif.CanonCs.PhotoEffect                     Short       1  (65535)
Exif.CanonCs.ManualFlashOutput               Short       1  n/a
Exif.CanonCs.ColorTone                       Short       1  0
Exif.CanonPi.ImageWidth                      Short       1  3072
Exif.CanonPi.ImageHeight                     Short       1  2048
Exif.CanonPi.ImageWidthAsShot                Short       1  3072
Exif.CanonPi.ImageHeightAsShot               Short       1  2048
Exif.CanonPi.AFPointsUsed                    Short       1  center
Exif.Photo.ColorSpace                        Short       1  sRGB
Exif.Canon.SerialNumberFormat                Long        1  Format 1
Exif.Image2.JPEGInterchangeFormat            Long        1  6929664
Exif.Image2.JPEGInterchangeFormatLength      Long        1  2120548

Both have exifs, but RT is only showing the message:
screen shot 2018-09-29 at 5 13 29 am

Related to #3801 (but hopefully fixable before that).

Testing with the 300D CRW, I've identified two reasons as to why this doesn't work (anymore):

  1. In FramesData::FramesData() exifManager.parseCIFF() is unreachable, if there's an exifManager.rml->ciffBase but no rml->exifBase. This was already the case before the multi-frame changes.
  2. In ExifManager::parseCIFF() there's no call to parse() like in all other parse*() variants, so at least the security check isn't triggered.

I've no clue, if this is the right way to go, but here's a preliminary patch:

diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc
index 572bd7e42..2f1ce0cc7 100644
--- a/rtengine/imagedata.cc
+++ b/rtengine/imagedata.cc
@@ -1100,37 +1100,35 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr<RawMetaDataL
         FILE* f = g_fopen (fname.c_str (), "rb");

         if (f) {
-            const bool has_rml_exif_base = rml->exifBase >= 0;
             rtexif::ExifManager exifManager (f, std::move(rml), firstFrameOnly);

-            if (has_rml_exif_base) {
-                if (exifManager.f && exifManager.rml) {
-                    if (exifManager.rml->exifBase >= 0) {
-                        exifManager.parseRaw ();
+            if (exifManager.f && exifManager.rml) {
+                if (exifManager.rml->exifBase >= 0) {
+                    exifManager.parseRaw ();

-                    } else if (exifManager.rml->ciffBase >= 0) {
-                        exifManager.parseCIFF ();
-                    }
+                } else if (exifManager.rml->ciffBase >= 0) {
+                    exifManager.parseCIFF ();
                 }
+            }

-                // copying roots
-                roots = exifManager.roots;
+            // copying roots
+            roots = exifManager.roots;

-                // creating FrameData
-                for (auto currFrame : exifManager.frames) {
-                    FrameData* fd = new FrameData(currFrame, currFrame->getRoot(), roots.at(0));
+            // creating FrameData
+            for (auto currFrame : exifManager.frames) {
+                FrameData* fd = new FrameData(currFrame, currFrame->getRoot(), roots.at(0));

-                    frames.push_back(fd);
-                }
-                for (auto currRoot : roots) {
-                    rtexif::Tag* t = currRoot->getTag(0x83BB);
+                frames.push_back(fd);
+            }
+            for (auto currRoot : roots) {
+                rtexif::Tag* t = currRoot->getTag(0x83BB);

-                    if (t && !iptc) {
-                        iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ());
-                        break;
-                    }
+                if (t && !iptc) {
+                    iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ());
+                    break;
                 }
             }
+
             fclose (f);
         }
     } else if (hasJpegExtension(fname)) {
diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc
index 0715ccfd6..a5f675db5 100644
--- a/rtexif/rtexif.cc
+++ b/rtexif/rtexif.cc
@@ -2107,6 +2107,7 @@ void ExifManager::parseCIFF ()
     exif->getDirectory()->addTag (mn);
     parseCIFF (rml->ciffLength, root);
     root->sort ();
+    parse(true);
 }

 Tag* ExifManager::saveCIFFMNTag (TagDirectory* root, int len, const char* name)

@Hombre57 Could you take a look, if what I changed is reasonable?

HTH,
Flössie

@Floessie I'll have a look ASAP (this week).

Still valid in 5.5-164-g540e35994.

Patch does not apply.

There's a reason for not leaving patches lying around for too long...

I can't even remember what I did and why, but I know that I'll take #3636 on this weekend, so I won't be of help here.

Best,
Flössie

Indeed, as the Igbo chieftain Albert Chinụalụmọgụ Achebe wrote, "Things Fall Apart".

@Thanatomanic Roel, do you have some time left to port my patch to current dev for 5.6?

Patch from above formatted for 5.5-165-g2c9dc3202

diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc
index d47bcccb4..bb43acd67 100644
--- a/rtengine/imagedata.cc
+++ b/rtengine/imagedata.cc
@@ -1293,35 +1293,31 @@ FramesData::FramesData (const Glib::ustring& fname, std::unique_ptr<RawMetaDataL
         FILE* f = g_fopen (fname.c_str (), "rb");

         if (f) {
-            const bool has_rml_exif_base = rml->exifBase >= 0;
             rtexif::ExifManager exifManager (f, std::move(rml), firstFrameOnly);
-
-            if (has_rml_exif_base) {
-                if (exifManager.f && exifManager.rml) {
-                    if (exifManager.rml->exifBase >= 0) {
-                        exifManager.parseRaw ();
-
-                    } else if (exifManager.rml->ciffBase >= 0) {
-                        exifManager.parseCIFF ();
-                    }
+            if (exifManager.f && exifManager.rml) {
+                if (exifManager.rml->exifBase >= 0) {
+                    exifManager.parseRaw ();
+                } else if (exifManager.rml->ciffBase >= 0) {
+                    exifManager.parseCIFF ();
                 }
+            }

-                // copying roots
-                roots = exifManager.roots;
+            // copying roots
+            roots = exifManager.roots;

-                // creating FrameData
-                for (auto currFrame : exifManager.frames) {
-                    frames.push_back(std::unique_ptr<FrameData>(new FrameData(currFrame, currFrame->getRoot(), roots.at(0))));
-                }
-                for (auto currRoot : roots) {
-                    rtexif::Tag* t = currRoot->getTag(0x83BB);
+            // creating FrameData
+            for (auto currFrame : exifManager.frames) {
+                frames.push_back(std::unique_ptr<FrameData>(new FrameData(currFrame, currFrame->getRoot(), roots.at(0))));
+            }
+            for (auto currRoot : roots) {
+                rtexif::Tag* t = currRoot->getTag(0x83BB);

-                    if (t && !iptc) {
-                        iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ());
-                        break;
-                    }
+                if (t && !iptc) {
+                    iptc = iptc_data_new_from_data ((unsigned char*)t->getValue (), (unsigned)t->getValueSize ());
+                    break;
                 }
             }
+
             fclose (f);
         }
     } else if (hasJpegExtension(fname)) {
diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc
index f8ec3e5db..82f5e5525 100644
--- a/rtexif/rtexif.cc
+++ b/rtexif/rtexif.cc
@@ -2116,6 +2116,7 @@ void ExifManager::parseCIFF ()
     }
     parseCIFF (rml->ciffLength, root);
     root->sort ();
+    parse(true);
 }

 Tag* ExifManager::saveCIFFMNTag (TagDirectory* root, int len, const char* name)

It compiled and worked well, Exif was shown for both D30 and 300D.

@Floessie I just ported the patch to apply to latest git and nothing more, so I'll leave it to you and @Hombre57 to decide what to do with it.

@Beep6581 @Floessie Works fine, as you found out. I didn't made the if (has_rml_exif_base) test, and didn't tried to see what are the implication, so I'm not the one who knows here. Anyway, :+1: to commit for me.

@Floessie Thanks for the fix. I didn't have time to test, but things seem to work now.

Was this page helpful?
0 / 5 - 0 ratings