This shell script will regenerate your thumbnails of sizes 128px and 360px so you'll see at least something in viewer.
sqlite3 ~/.local/share/shotwell/data/photo.db \
"select id||' '||filename from PhotoTable order by timestamp desc" |
while read id filename; do
for size in 128 360; do
tf=$(printf ~/.cache/shotwell/thumbs/thumbs${size}/thumb%016x.jpg $id);
test -e "$tf" || {
echo -n "Generating thumb for $filename ($tf)";
convert "$filename" -auto-orient -thumbnail ${size}x${size} $tf
echo
}
done
done
Nautilus's thumbnailing routines actually come from the libgnome-desktop
library, so it is possible to run the same thumbnailers outside of the file manager.
The API is a little complex, but the following Python script should help:
#!/usr/bin/python
import os
import sys
from gi.repository import Gio, GnomeDesktop
def make_thumbnail(factory, filename):
mtime = os.path.getmtime(filename)
# Use Gio to determine the URI and mime type
f = Gio.file_new_for_path(filename)
uri = f.get_uri()
info = f.query_info(
'standard::content-type', Gio.FileQueryInfoFlags.NONE, None)
mime_type = info.get_content_type()
if factory.lookup(uri, mtime) is not None:
print "FRESH %s" % uri
return False
if not factory.can_thumbnail(uri, mime_type, mtime):
print "UNSUPPORTED %s" % uri
return False
thumbnail = factory.generate_thumbnail(uri, mime_type)
if thumbnail is None:
print "ERROR %s" % uri
return False
print "OK %s" % uri
factory.save_thumbnail(thumbnail, uri, mtime)
return True
def thumbnail_folder(factory, folder):
for dirpath, dirnames, filenames in os.walk(folder):
for filename in filenames:
make_thumbnail(factory, os.path.join(dirpath, filename))
def main(argv):
factory = GnomeDesktop.DesktopThumbnailFactory()
for filename in argv[1:]:
if os.path.isdir(filename):
thumbnail_folder(factory, filename)
else:
make_thumbnail(factory, filename)
if __name__ == '__main__':
sys.exit(main(sys.argv))
Save this to a file and mark it executable. You may also need to install the gir1.2-gnomedesktop-3.0
package if it is not already installed.
After that, simply invoke the script with the files or folders you want to thumbnail as arguments. Thumbnails will be saved to ~/.thumbnails
where applications like Nautilus expect to find them.
Best Answer
Remove all contents of
~/.cache/thumbnails/normal
:...and refresh the folder in thunar.