Thumbnails: Difference between revisions
Move gdk-pixbuf above nufraw for RAW processing |
Added a header so the newer image format section is more visible |
||
| (8 intermediate revisions by 3 users not shown) | |||
| Line 4: | Line 4: | ||
On minimal / custom desktop environments thumbnails in file explorers may not work by default. For example: | On minimal / custom desktop environments thumbnails in file explorers may not work by default. For example: | ||
* GNOME environments with the option <code>services.gnome.core-utilities.enable = false;</code> | * [[GNOME]] environments with the option <code>services.gnome.core-utilities.enable = false;</code> | ||
* Custom environments built from ground-up using window managers like | * Custom environments built from ground-up using window managers like [[Sway]] or [[Hyprland]] | ||
=== Save yourself hours of troubleshooting!! === | === Save yourself hours of troubleshooting!! === | ||
| Line 30: | Line 30: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# configuration.nix | # configuration.nix | ||
{ pkgs, ... }: | { pkgs, ... }: | ||
{ | { | ||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs.ffmpeg-headless | pkgs.ffmpeg-headless | ||
| Line 39: | Line 39: | ||
# 'ffmpegthumbnailer.thumbnailer' is created in '/run/current-system/sw/share/thumbnailers' | # 'ffmpegthumbnailer.thumbnailer' is created in '/run/current-system/sw/share/thumbnailers' | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 48: | Line 47: | ||
Thumbnails for the following MimeTypes are enabled: ''image/png; image/jpeg; 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; 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.'' | Thumbnails for the following MimeTypes are enabled: ''image/png; image/jpeg; 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; 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.'' | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"># configuration.nix | ||
# configuration.nix | { pkgs, ... }: | ||
{ pkgs, ... }: | |||
{ | { | ||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs.gdk-pixbuf | pkgs.gdk-pixbuf | ||
| Line 58: | Line 56: | ||
# 'gdk-pixbuf-thumbnailer.thumbnailer' is created in '/run/current-system/sw/share/thumbnailers' | # 'gdk-pixbuf-thumbnailer.thumbnailer' is created in '/run/current-system/sw/share/thumbnailers' | ||
}</syntaxhighlight> | |||
==== Thumbnails for newer image formats such as AVIF and JPEG XL ==== | |||
For newer image formats not included in <code>gdk-pixbuf</code> you can enable thumbnails by adding their specific image libraries into the system packages as seen below<syntaxhighlight lang="nix"># configuration.nix | |||
{ pkgs, ... }: | |||
= | { | ||
environment.systemPackages = [ | |||
# For general HEIF container support (this includes the AVIF file format) | |||
pkgs.libheif.bin # provides heif-thumbnailer (the program that generates HEIF thumbnails) | |||
pkgs.libheif.out # provides heif.thumbnailer (allows for the viewing of HEIF thumbnails) | |||
# For more newer AVIF specific support usually not needed if libheif is installed | |||
pkgs.libavif | |||
# For JXL(JPEG XL) support | |||
pkgs.libjxl | |||
# For WebP support | |||
pkgs.webp-pixbuf-loader | |||
]; | |||
# All of the thumbnailers are created in '/run/current-system/sw/share/thumbnailers' | |||
}</syntaxhighlight> | |||
<syntaxhighlight lang="nix"> | === Enable 3D Model Thumbnails === | ||
Thumbnails for various 3D model files can be enabled by installing f3d:<syntaxhighlight lang="nix"> | |||
# configuration.nix | # configuration.nix | ||
{ pkgs, ... }: | { pkgs, ... }: | ||
{ | { | ||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs. | pkgs.f3d | ||
]; | ]; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 84: | Line 95: | ||
==== gdk-pixbuf thumbnailer ==== | ==== gdk-pixbuf thumbnailer ==== | ||
gdk-pixbuf can be used to generate thumbnails for RAW camera image formats by reading the embedded jpeg. This embedded jpeg is typically generated in the camera or overwritten by your RAW editing software, and may not match what the photo looks like when opened in a viewer or editor. | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 91: | Line 102: | ||
{ | { | ||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs.gdk-pixbuf | pkgs.gdk-pixbuf | ||
| Line 108: | Line 118: | ||
# Test other formats by adding them above | # Test other formats by adding them above | ||
]; | ]; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 119: | Line 128: | ||
<syntaxhighlight lang="nix"># configuration.nix | <syntaxhighlight lang="nix"># configuration.nix | ||
{ pkgs, ... }: | { pkgs, ... }: | ||
{ | { | ||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs.nufraw | pkgs.nufraw | ||
| Line 128: | Line 137: | ||
# 'nufraw.thumbnailer' is created in '/run/current-system/sw/share/thumbnailers' | # 'nufraw.thumbnailer' is created in '/run/current-system/sw/share/thumbnailers' | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
| Line 138: | Line 146: | ||
Output of <code>cat /run/current-system/sw/share/thumbnailers/nufraw.thumbnailer</code>: | Output of <code>cat /run/current-system/sw/share/thumbnailers/nufraw.thumbnailer</code>: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="desktop"> | ||
[Thumbnailer Entry] | [Thumbnailer Entry] | ||
TryExec=/nix/store/piss9dl8i5xnfm5yagdffgxycm8lsqpl-nufraw-0.43-3/bin/nufraw-batch | TryExec=/nix/store/piss9dl8i5xnfm5yagdffgxycm8lsqpl-nufraw-0.43-3/bin/nufraw-batch | ||
| Line 153: | Line 161: | ||
{ | { | ||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs.nufraw | pkgs.nufraw | ||
pkgs.nufraw-thumbnailer | pkgs.nufraw-thumbnailer | ||
# Thumbnails | # Thumbnails from 'raw' data and include EXIF tags for Adobe-DNG images | ||
(pkgs.writeTextFile { | (pkgs.writeTextFile { | ||
name = "my-custom-nufraw-thumbnailer"; | name = "my-custom-nufraw-thumbnailer"; | ||
| Line 169: | Line 176: | ||
}) | }) | ||
# MimeTypes not listed here but listed in the default nufraw.thumbnailer will continue displaying | # MimeTypes not listed here but listed in the default nufraw.thumbnailer will continue displaying | ||
# thumbnails generated from the 'embedded jpeg' without the EXIF metadata | |||
]; | ]; | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
| Line 202: | Line 208: | ||
<syntaxhighlight lang="nix"># configuration.nix | <syntaxhighlight lang="nix"># configuration.nix | ||
{ pkgs, ... }: { | { pkgs, ... }: | ||
{ | |||
environment.systemPackages = [ | environment.systemPackages = [ | ||
( | (pkgs.writeTextFile { | ||
# This can be anything, it's just the name of the derivation in the nix store | |||
name = "krita-thumbnailer"; | |||
# This is the important part, the path under which this will be installed | |||
destination = "/share/thumbnailers/kra.thumbnailer"; | |||
# The contents of your thumbnailer, don't forget to specify the full path to executables | |||
text = '' | |||
[Thumbnailer Entry] | |||
Exec=sh -c "${pkgs.unzip}/bin/unzip -p %i preview.png > %o" | |||
MimeType=application/x-krita; | |||
''; | |||
}) | |||
]; | ]; | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||