If you are into Linux and Photography (some of us are) and you, like me, have a not-very old Canon camera, you may see that the RAW files are no longer CR2 files, but with extension CR3. CR3 raw format is the new replacement for CR2 that comes with all Dig!c8 (or better) chipsets. In my very specific case, with my Canon 90D and R6.

canon 90d

I was amazed by the quality of this camera (I come from a Canon 200D aka SL2 that has a Digic7 chip). Canon did a good job from version 7 to 8. However, here comes the issue, I saved my photos in CR3 format, and when going to my desktop, neither KDE/Plasma nor Darktable (current version 3.2.1 when writing this article) were able to recognize it. Windows is not an option for me.

UPDATE: Since Darktable 3.8 you can open CR3 files If you compile it with exiv2 version 0.27.4 with BMFF support enabled through its RawSpeed library.

Google is Your Friend: Convert to DNG

So, here it comes. Google! I found that I was not alone in this situation. Although there is an effort to give Linux (libgphoto) proper CR3 support, it is not production-ready. Someone suggested converting it to DNG format.

DNG (patented by Adobe) is an open standard for digital negatives. Nowadays, almost every mobile device supports it. My Google Pixel 2, 3 and 4 currently save its raw format in DNG files.

After googling, I found https://rawpedia.rawtherapee.com/How_to_convert_raw_formats_to_DNG which suggests a way to do it. It works, but not out of the box as the article says. As I use Mageia as my desktop distribution, I will describe here what I did to make it work.

Converting CR3 to DNG with Linux Mageia

Follow these steps:

  • Install WINE with 64-bit support. In Mageia is a simple urpmi wine64. Mageia 7 comes with Wine 4.0.3.
  • Download the latest version of the Adobe DNG Converter for Windows.Adobe DNG Converter for Windows. The last available reversion when writing this article is 12.2.
  • Install the software by typing WINEPREFIX="$HOME/wine-dng" wine ~/path-to/DNGConverter_version.exe. Your WINEPREFIX could be anything, it is a good idea to isolate specific software instead of letting Wine put it all inside the ~/.local/ directory. After finishing the installation, you will have it installed at $HOME/wine-dng/drive_c/Program Files/Adobe/Adobe DNG Converter/Adobe DNG Converter.exe
  • If using WINE < 5.0-rc5, you must disable the api-ms-win-core-winrt-error-l1-1-0 flag. Type WINEPREFIX="$HOME/wine-dng" winecfg and within the library tab add it and then disable it.
    wine config
  • Once you have done this, use WINEPREFIX="$HOME/wine-dng" wine64 "$HOME/wine-dng/drive_c/Program Files/Adobe/Adobe DNG Converter/Adobe DNG Converter.exe" to call it. Pay attention to where your WINE installs things, some versions may create a "Program Files (x86)" directory instead. The rawpedia article suggests an alias from the command line, I think it is better if you add a menu to your desktop as this is a graphic program.
  • When converting, you will find that many people suggest using a custom configuration with an explicit DNG 1.4 plus linear setting (without mosaic). In my case, that didn't work. When I opened the exported DNG files with Darktable, I got a green picture. After playing with some settings, I found it works with the Camera Raw 11.2 settings and with a medium-size JPEG preview.
    adobe digital negative settings
    Conversion is a heavy CPU task, your computer may be frozen for a while. My desktop (12 cores, 3Ghz i7's) did for a while.
  • Open those new DNG files.

Is Metadata Lost During the CR3 to DNG Conversion?

Not at all, at least not in my comparisons. I did the following test to make sure:

  1. Linked my Canon 90D with my cellphone's GPS,
  2. Configure my camera to save in RAW+JPEG (both files),
  3. Took the photo & downloaded it to my PC,
  4. Review the metadata of the JPEG, I can confirm there were geotags and EXIF information in there,
  5. Convert the CR3 file to DNG with the method I described, and
  6. Review the metadata of the new DNG file and compare it against the original JPEG from the camera.

I can say they are identical with the exception that Adobe DNG Converter adds a "Document Generated" tag and changes the length and width of the new NDG (around 5% larger). However, Darktable reports the right dimensions, so no need to worry about that. Besides that, all the values are quite the same. See the following image.

converted dng vs native jpeg metadata

Happy editing!

";