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]
    TryExec=ufraw-batch
    Exec=ufraw-batch --silent --size %s --out-type=png --noexif --output=%o --overwrite --embedded-image %i
    MimeType=image/x-adobe-dng;image/x-canon-cr2;image/x-canon-crw;image/x-dcraw;image/x-fuji-raf;image/x-kodak-dcr;image/x-kodak-k25;image/x-kodak-kdc;image/x-minolta-mrw;image/x-nikon-nef;image/x-olympus-orf;image/x-panasonic-raw;image/x-pentax-pef;image/x-sigma-x3f;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;