Skip to content

Instantly share code, notes, and snippets.

@Fmstrat
Created July 6, 2026 17:43
Show Gist options
  • Select an option

  • Save Fmstrat/ea91d9891dfceb1a0de762e7a4114a85 to your computer and use it in GitHub Desktop.

Select an option

Save Fmstrat/ea91d9891dfceb1a0de762e7a4114a85 to your computer and use it in GitHub Desktop.
Ubuntu/GNOME RAW thumbnails without extra software.
#!/usr/bin/env bash
SUPPORTED="
application/ico
application/x-navi-animation
image/bmp
image/gif
image/ico
image/icon
image/jpeg
image/png
image/qtif
image/tiff
image/vnd.microsoft.icon
image/x-3fr
image/x-MS-bmp
image/x-adobe-dng
image/x-arw
image/x-bay
image/x-bmp
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-icns
image/x-ico
image/x-icon
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-portable-anymap
image/x-portable-bitmap
image/x-portable-graymap
image/x-portable-pixmap
image/x-ptx
image/x-pxn
image/x-quicktime
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-tga
image/x-win-bitmap
image/x-x3f
image/x-xbitmap
image/x-xpixmap
text/ico
"
EXISTING=$(grep ^MimeType /usr/share/thumbnailers/gdk-pixbuf-thumbnailer.thumbnailer |sed 's/MimeType=//g;s/\;/ /g')
for E in ${EXISTING}; do
FOUND=false
for S in ${SUPPORTED}; do
if [ "${S}" = "${E}" ]; then
FOUND=true
break;
fi
done
if [ "${FOUND}" = "false" ]; then
SUPPORTED="${SUPPORTED} ${E}"
echo ${E}
fi
done
NEW=$(echo ${SUPPORTED} |sed -E 's/\s+/;/g')
cp /usr/share/thumbnailers/gdk-pixbuf-thumbnailer.thumbnailer /tmp/gdk-pixbuf-thumbnailer.thumbnailer.bak
sudo sed -i "s|^MimeType=.*|MimeType=${NEW}|g" /usr/share/thumbnailers/gdk-pixbuf-thumbnailer.thumbnailer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment