Copy old Canon RAW metadata into EXIF

Started by lightproof, May 13, 2019, 02:27:06 PM

Previous topic - Next topic

lightproof

Hi!

I have a bunch of old Canon CRW RAW files shot on EOS 300D. When I view them in Photo Mechanic or FastStone viewer I see no metadata, particularly no capture time and date. I checked the files with exiftool and there are no EXIF tags, only MakerNotes, which, I presume, are Canon RAW data. Is there a way to copy Canon data into EXIF fields? My primary goal is date and time, although ideally I would like having other data like lens, focal length, ISO, exposure etc. copied into EXIF as well.

So far I have tried to copy only the DateTimeOriginal value, and got the following results:

exiftool -v "-alldates<datetimeoriginal" — writes the time into XMP fields only. Both viewers still ignore it

exiftool -v "-EXIF:alldates<datetimeoriginal" — doesn't change the file at all, despite, apparently, attempting to write EXIF (it says Editing tags in ExifIFD IF0)

Is there anything I'm missing? Thanks.

Phil Harvey

CRW files don't support EXIF metadata.  You can only add XMP to these files.

See the CRW entry in this table.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lightproof

Quote from: Phil Harvey on May 13, 2019, 03:15:31 PM
CRW files don't support EXIF metadata.  You can only add XMP to these files.


Thanks so much for the answer (and for exiftool)! That explains the behaviour.

What would be the proper way to copy all the Canon metadata to both internal XMP tags and external XMP sidecar file? Or at least to the sidecar file alone, so Photo Mechanic would (presumably) see it?

Phil Harvey

I don't know what type of metadata PhotoMechanic can read from a CRW file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lightproof

#4
It can read only camera model (either that, or I'm doing something wrong). Apparently, Photo Mechanic reads THM sidecar files (of the CRW/THM pair) that contain EXIF metadata, but I have deleted all the THM files many years ago, before I learned about metadata. In my defence, all the software I used then read Canon's metadata just fine :)

That's why I'd like to copy Canon's metadata into XMP sidecar files, (which Photo Mechanic reads just fine), but I have no idea how to do it properly, or if exiftool can do it at all.

StarGeek

You'll have to do some experimentation on your own but take a look at the examples under Metadata Sidecar Files.

For a file that doesn't already have a sidecar file, test with example #2.  If it does already have a sidecar file, try example 1.  That will copy all the obvious, same name tags from the CRW file to the side car.

I downloaded a sample CRW file from RawSamples.ch, used the first command, and this was the data in the resulting xmp file
---- XMP-x ----
XMPToolkit                      : Image::ExifTool 11.43
---- XMP-getty ----
OriginalFileName                : CRW_0003.CRW
---- XMP-aux ----
Lens                            : 17.0 - 50.0 mm
---- XMP-crs ----
ColorTemperature                : 5200
---- XMP-exif ----
ColorSpace                      : Adobe RGB
Contrast                        : Normal
DateTimeOriginal                : 2007:03:03 11:26:42
ExposureCompensation            : +1
ExposureTime                    : 1/35
FNumber                         : 2.8
FocalLength                     : 36.0 mm
ISO                             : 400
Saturation                      : Normal
Sharpness                       : Normal
UserComment                     :
---- XMP-exifEX ----
SerialNumber                    : 1230408320
OwnerName                       : Markus Schlieper
---- XMP-pmi ----
SequenceNumber                  : 0
---- XMP-tiff ----
ImageHeight                     : 2048
ImageWidth                      : 3072
Make                            : Canon
Model                           : Canon EOS 300D DIGITAL
Orientation                     : Horizontal (normal)


If that works for you, then you can proceed to example 11 for files that don't already have a sidecar file and example 12 for files that do already have a sidecar file.   Just replace EXT in both of those examples with CRW.

If you decide that you want to change the location of a tag, for example, in the above data you want OwnerName to be copied to XMP:Creator (a likely situation), then you would examine the full output of the CRW file using exiftool -g1 -a -s (from FAQ #3), select the tag name from the raw and use the -TagsFromFile option to copy the data.  For example,
exiftool -ext xmp -tagsfromfile %d%f.EXT "-XMP:Creator<OwnerName " -r DIR
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

lightproof