Gnome thumbnailer for Canon .cr2 files

The default Ubuntu package for creating thumbnails for Canon .cr2 files (a.k.a. raw files) is gnome-raw-thumbnailer. It works well, but it’s slow unless you have a fast computer with a fast disk. I found this page, which describes how to create a thumbnailer based on ufraw-batch --embedded-image, which executes really quickly because it just reads the thumbnail image that’s already embedded in the .cr2 file. The recipe there didn't work for me out of the box, though; but when I replaced the mime type list with the one that gnome-raw-thumbnailer uses, it worked like a charm and was super fast!

For the record, the complete procedure is

  1. Install ufraw-batch.
  2. Create a text file called /usr/share/thumbnailers/raw.thumbnailer (I guess the “raw” part can be replaced with any name you like) with the following contents:
    [Thumbnailer Entry]
    Exec=ufraw-batch --silent --size %s --out-type=png --noexif --output=%o --overwrite --embedded-image %i