hæx.com logo

Fixing CR3 RAW Thumbnails in KDE/Dolphin

Canon switched from CR2 to CR3 (Canon Raw 3) in 2018. Since then, CR3 files show as generic icons in KDE's Dolphin file manager, no thumbnails. CR2 files work perfectly. This seems to affect every recent Canon user on KDE, so me and (mostly) Claude Opus 4.6 tried to fix it.

KDE Bug #489045: https://bugs.kde.org/show_bug.cgi?id=489045

The Rabbit Holes

Before finding the real fix, we chased several leads:

  • MIME magic bytes missing: CR3 had no content-based detection, only filename globs. We added magic bytes (ftypcrx at offset 4) to a local MIME definition. Fixed xdg-mime detection, but thumbnails still didn't appear.
  • Thumbnailer MIME type mismatch: rawthumbnail.so only listed image/x-dcraw, not image/x-canon-cr3. KF6 doesn't resolve MIME subclass relationships. Adding CR3 to the plugin metadata was necessary, but not sufficient alone.
  • KDcraw API too old for CR3?: We suspected KDcraw used LibRaw's old unpack_thumb() which might not work for CR3's ISO BMFF container, and that the newer unpack_thumb_ex() was needed. Turned out unpack_thumb() works fine for CR3. KDcraw never even gets that far.
  • Qt memory allocation limit: Qt's QImageReader has a 256MB limit. Canon R5 RAW decodes to ~267MB. We built a workaround that raised the limit and did full RAW decoding as a fallback. It worked, but was slow, decoding 45 megapixels just to make a thumbnail.

Each of these was a real issue in the pipeline, but none was the actual blocker.

The Final Clue

Renaming a .CR3 file to .CR2 produces an instant thumbnail. Same file contents, different extension, perfect result. That's a suspicious kind of broken.

The Investigation

KDE's thumbnail pipeline for RAW files:

Dolphin -> kio thumbnail worker -> rawthumbnail.so -> KDcraw (libkdcraw) -> LibRaw

Does the thumbnailer plugin know about CR3?

rawthumbnail.so declares it handles image/x-dcraw. CR3's MIME type image/x-canon-cr3 is a subclass of image/x-dcraw in the system MIME database, but KF6's plugin system doesn't resolve MIME subclass relationships. So the thumbnailer is never invoked for CR3. Fix #1: add image/x-canon-cr3 to rawthumbnail.json.

Can LibRaw extract CR3 thumbnails?

Yes. LibRaw 0.21.4 handles CR3 perfectly:

File: r5-craw.CR3 (Canon EOS R5)
Thumb count: 3
  Thumb[0]: 160x120 JPEG (5KB)
  Thumb[1]: 1620x1080 JPEG (68KB)
  Thumb[2]: full-size JPEG (1.19MB)

unpack_thumb() -> SUCCESS (1.19MB JPEG)

All three embedded previews extract instantly. So why does KDcraw fail?

The Root Cause

KDcraw's loadEmbeddedPreview() does this before calling LibRaw:

QString rawFilesExt = QString::fromUtf8(rawFiles());
QString ext = fileInfo.suffix().toUpper();
if (!rawFilesExt.toUpper().contains(ext))
    return false;

It checks the file extension against a hardcoded whitelist in rawfiles.h. That list includes *.cr2 and *.crw, but not *.cr3. The function returns false without ever calling LibRaw. LibRaw would have handled it fine.

This is why renaming .CR3 to .CR2 works, it passes the extension check, then LibRaw opens the file by content and extracts the embedded JPEG preview instantly.

The whitelist hasn't been updated since "Version 5" and is missing CR3 along with potentially other newer formats.

The Fix

Two changes needed across two KDE projects:

1. libkdcraw, Add CR3 to the extension whitelist

In src/rawfiles.h, add "*.cr3 " to the raw_file_extentions[] array. That's it. One line.

2. kdegraphics-thumbnailers, Add CR3 MIME type

In raw/rawthumbnail.json, add "image/x-canon-cr3" to the MimeTypes array, because KF6 doesn't resolve MIME subclass hierarchies.

Result

CR3 thumbnails appear instantly in Dolphin, same speed as CR2, because it's extracting an embedded 1620×1080 JPEG preview rather than decoding 45 megapixels of RAW data.

Workaround (until upstream is patched)

For a local fix that doesn't require patching libkdcraw, you can modify rawcreator.cpp in kdegraphics-thumbnailers to call LibRaw directly as a fallback when KDcraw fails. This bypasses the extension whitelist entirely.

CR3 File Format Details

CR2CR3
ContainerTIFF-basedISO Base Media File Format (like MP4)
Introduced20042018
Magic bytes49 49 2a 00 + 43 52 02 00ftypcrx at offset 4
MIME typeimage/x-canon-cr2image/x-canon-cr3
MIME subclassimage/x-dcraw, image/tiffimage/x-dcraw
Embedded previewsYes (TIFF-accessible)Yes (ISO BMFF boxes: THMB, PRVW)
LibRaw supportFullFull (since ~2019)
KDcraw supportWorksBlocked by extension whitelist

Affected Cameras

Every Canon camera since 2018 that shoots CR3:

  • EOS R, RP, R3, R5, R5 II, R6, R6 II, R7, R8, R10, R50, R100
  • EOS 90D, 250D, 850D
  • EOS M50, M50 II, M6 II, M200
  • PowerShot G5 X II, G7 X III

System Info

  • Kubuntu 25.10
  • KDE Plasma 6 / KF6
  • LibRaw 0.21.4
  • kdegraphics-thumbnailers 25.08.1
  • libkdcrawqt6 25.08.1