15

I'm not getting any thumbnails in nautilus for my NEF files (photo raw). Is there an easy way to repair this?

Braiam
  • 67,791
  • 32
  • 179
  • 269

6 Answers6

33

By default, Ubuntu doesn’t display thumbnails for NEF files. But you can try (as explained in this blog post) installing UFraw.

sudo apt-get install ufraw

And if itś not already existing, create a thumbnailer file /usr/share/thumbnailers/ufraw.thumbnailer, with content :

[Thumbnailer Entry]
Exec=/usr/bin/ufraw-batch --embedded-image --out-type=png --size=%s %u --overwrite --silent --output=%o
MimeType=image/x-3fr;image/x-adobe-dng;image/x-arw;image/x-bay;image/x-canon-cr2;image/x-canon-crw;image/x-cap;image/x-cr2;image/x-crw;image/x-dcr;image/x-dcraw;image/x-dcs;image/x-dng;image/x-drf;image/x-eip;image/x-erf;image/x-fff;image/x-fuji-raf;image/x-iiq;image/x-k25;image/x-kdc;image/x-mef;image/x-minolta-mrw;image/x-mos;image/x-mrw;image/x-nef;image/x-nikon-nef;image/x-nrw;image/x-olympus-orf;image/x-orf;image/x-panasonic-raw;image/x-pef;image/x-pentax-pef;image/x-ptx;image/x-pxn;image/x-r3d;image/x-raf;image/x-raw;image/x-rw2;image/x-rwl;image/x-rwz;image/x-sigma-x3f;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;image/x-sr2;image/x-srf;image/x-x3f;

This file basically say to exec ufraw-batch (with the good parameters) on any file with the specified mimetypes (including image/x-nef).

yoann-h
  • 195
Rémi
  • 945
  • 1
    +1, a small correction needed, it should be /usr/share/thumbnailers instead of /usr/share/thumbnailer – danijelc Dec 17 '13 at 11:04
  • 1
    I have a Panasonic camera, which creates RW2 files. I had to add the MIME Type of image/x-panasonic-raw2; to the end of the last line above. Works a charm after that! :) – seanlano Jan 12 '16 at 08:19
  • This does not work out the box on ubuntu 18.04, below answer from @Dan works great. – dogmatic69 Oct 23 '18 at 19:37
  • This works in 19.04. – Christians May 09 '19 at 14:58
  • I can confirm this also work in 19.10, without even needing to restart Nautilus. NOTE: in my case I had to add image/x-panasonic-rw2 to the list of MIME types in the ufraw.thumbnailer file. – seanlano Sep 20 '19 at 14:48
  • E: Package 'ufraw' has no installation candidate – Florian Ludewig Feb 23 '20 at 10:50
  • In order for this to work on RAW files which already had a preview generated, I had to clear the thumbnails cache with nautilus -q; rm -rf .cache/thumbnails/* .thumbnails/* and then start Nautilus again. After what, it works like a charm! Thanks :) https://gist.github.com/h4cc/13450db3d4a7457f9b38 – Alexandre Sep 17 '20 at 07:41
13

Okay, most of the answers here either don't work from Ubuntu 19.10, or are slow because they process the RAW files.

NEF files (and probably lots of other formats) have embedded JPEG's previews in them, which is a lot faster to extract. And lo' and behold, the default thumbnailer for Gnome supports them, but they're not enabled, here's how to enable it:

  • you have to edit the file /usr/share/thumbnailers/gdk-pixbuf-thumbnailer.thumbnailer to add the missing MIME types.
  • Here's the file before:
[Thumbnailer Entry]
TryExec=/usr/bin/gdk-pixbuf-thumbnailer
Exec=/usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o
MimeType=image/png;image/bmp;image/x-bmp;image/x-MS-bmp;image/gif;image/x-icon;image/x-ico;image/x-win-bitmap;image/vnd.microsoft.icon;application/ico;image/ico;image/icon;text/ico;application/x-navi-animation;image/jpeg;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/tiff;image/x-xpixmap;image/x-xbitmap;image/x-tga;image/x-icns;image/x-quicktime;image/qtif;
  • You may append just image/x-nef;image/x-nikon-nef; for NEF if you want, or you can add all RAW formats (I just did that):
image/x-3fr;image/x-adobe-dng;image/x-arw;image/x-bay;image/x-canon-cr2;image/x-canon-crw;image/x-cap;image/x-cr2;image/x-crw;image/x-dcr;image/x-dcraw;image/x-dcs;image/x-dng;image/x-drf;image/x-eip;image/x-erf;image/x-fff;image/x-fuji-raf;image/x-iiq;image/x-k25;image/x-kdc;image/x-mef;image/x-minolta-mrw;image/x-mos;image/x-mrw;image/x-nef;image/x-nikon-nef;image/x-nrw;image/x-olympus-orf;image/x-orf;image/x-panasonic-raw;image/x-panasonic-raw2;image/x-pef;image/x-pentax-pef;image/x-ptx;image/x-pxn;image/x-r3d;image/x-raf;image/x-raw;image/x-rw2;image/x-rwl;image/x-rwz;image/x-samsung-srw;image/x-sigma-x3f;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;image/x-sr2;image/x-srf;image/x-x3f;
  • 3
    Beautiful, the actual raw processor was taking seconds per file to generate the thumbnail and would've taken an hour for my directory. This is much quicker and more helpful for just casual browsing. – Mark Peters Mar 04 '20 at 14:17
  • 3
    I can confirm this works in ubuntu 20.04 (which currently doesn't have ufraw or gnome-raw-thumbnailer packages for some reason). – Sindhudweep Mar 26 '20 at 00:39
  • this is so much better than installing additional software, and it also renders faster. wonderful solution! Tested and works on Linux Mint 19.3 – Alexander Köb Sep 24 '20 at 20:38
  • This doesn't seem to work for x-sony-arw (A6000) on 21.04 for some reason... – RiquezJP Jul 27 '21 at 04:26
  • 1
    Works great on Ubuntu 22 LTS for NEF files. – igor Jan 11 '23 at 08:08
8

You can install the following packages, and Nautilus will start displaying thumbnails for NEF files without having to do any manual configuration.

18.04 and newer:

sudo apt install libopenraw7 libopenrawgnome7 gnome-raw-thumbnailer

It seems the libopenraw1 and libopenrawgnome1 are no longer available in 18.04 and above, they were replaced by libopenraw7 and libopenrawgnome7. In fact, the 2 libraries don't seem to be required to generate the thumbnails and can be skipped. However, if you include them, the generation of the thumbnails becomes much faster.

16.04 and earlier:

sudo apt-get install libopenraw1 libopenrawgnome1 gnome-raw-thumbnailer

source: Ubuntu Foums - viewing nikon NEF raw files?

Dan
  • 13,119
  • 1
    not work at ubuntu 18.04. Can't find package libopenraw1 and libopenrawgnome1. – Tomasz Fijałkowski Sep 03 '18 at 07:41
  • 1
    This works great on ubuntu 18, but the packages are libopenraw7 or -dev, just remove the 1 and tab, you will quickly see what the correct package is. I used s/1/-dev for both. – dogmatic69 Oct 23 '18 at 19:38
  • @dogmatic69 Thanks for the info! I updated my answer. However, there's no need to install the -dev packages. It should be enough to use libopenraw7 and libopenrawgnome7. – Dan Oct 23 '18 at 22:44
  • 2
    As a matter of fact, it seems the libopenraw* libraries are not needed, and gnome-raw-thumbnailer is enough. But having them installed is making the generation of the thumbnails A LOT faster. – Dan Oct 23 '18 at 22:51
  • In Ubuntu 20.04 I get Unable to locate package gnome-raw-thumbnailer. Simply editing /usr/share/thumbnailers/gdk-pixbuf-thumbnailer.thumbnailer as per https://askubuntu.com/a/1204150/292055 worked for me in 20.04. – SuprMan Jul 06 '21 at 23:02
3

ufraw is no longer available so in order to have thumbnails in nautilus in 20.04 you need something different. I'm using dcraw, however it only converts to ppm or tiff. And the gnome thumbnails need to be png. So in this solution I use ImageMagic convert.

Here is my solution:

  1. Install dependencies:
sudo apt install dcraw ImageMagick
  1. create a script to combine the 2 commands
sudo nano /sbin/rawthumbnailer

and put the paste the following in it:

#!/bin/bash

/usr/bin/dcraw -c -w -v -h "${1}" | /usr/bin/convert - -resize x"${2}" png:"${3}"

Don't forget the execution flag:

sudo chmod +x /sbin/rawthumbnailer
  1. create the thumbnailer script in /usr/share/thumbnailers:
sudo nano /usr/share/thumbnailers/raw.thumbnailer

The contents should read as this

[Thumbnailer Entry]
TryExec=/sbin/rawthumbnailer
Exec=/sbin/rawthumbnailer %i %s %o
MimeType=image/x-canon-cr2;image/x-canon-crw;image/x-minolta-mrw;image/x-nikon-nef;image/x-pentax-pef;image/x-panasonic-raw2;image/x-samsung-srw;image/x-olympus-orf;image/x-3fr;image/x-adobe-dng;image/x-arw;image/x-bay;image/x-canon-cr2;image/x-canon-crw;image/x-cap;image/x-cr2;image/x-crw;image/x-dcr;image/x-dcraw;image/x-dcs;image/x-dng;image/x-drf;image/x-eip;image/x-erf;image/x-fff;image/x-fuji-raf;image/x-iiq;image/x-k25;image/x-kdc;image/x-mef;image/x-minolta-mrw;image/x-mos;image/x-mrw;image/x-nef;image/x-nikon-nef;image/x-nrw;image/x-olympus-orf;image/x-orf;image/x-panasonic-raw;image/x-panasonic-raw2;image/x-pef;image/x-pentax-pef;image/x-ptx;image/x-pxn;image/x-r3d;image/x-raf;image/x-raw;image/x-rw2;image/x-rwl;image/x-rwz;image/x-samsung-srw;image/x-sigma-x3f;image/x-sony-arw;image/x-sony-sr2;image/x-sony-srf;image/x-sr2;image/x-srf;image/x-x3f;
  1. Restart nautilus:
nautilus -q

If you tried before and didn't succeed you should delete the thumbnails

rm -rf ~/.cache/thumbnails/*

or at least the failed thumbs dir

rm -rf ~/.cache/thumbnails/fail

The script needs to be in /sbin, /bin or /usr... as the generation is happening using the bwrap and there are only some directories binded in it. I tried to follow this to have the script in home, but it didn't work for me.

Also I was unable to make it work without the script file. Not sure if it is possible or not, but I prefer to have a simpler solution with less files if possible.

Otsonev
  • 31
2

At ubuntu 18.04 just install gnome-raw-thumbnailer:

sudo apt-get install gnome-raw-thumbnailer
0

I am using gnome 15.10 , got non problem with nikon.nef and canon.cr2 ,but no way to show thumbnails of nikon.NRW

  • I can get preview only by script using dcraw , but not in gnome-thumnailers

Here the script i set in nautilus :

#!/bin/bash
FILES="$@"
for i in $FILES
do
echo "Processing image $i ..."
/usr/bin/dcraw -e  $i thumb.$i
done

Of course this make a new jpeg on side of the pic....

muru
  • 197,895
  • 55
  • 485
  • 740
Gab_
  • 1