Vignette is a Python library to create and manage thumbnails following the FreeDesktop standard.
Thumbnails are stored in a shared directory so other apps following the standard can reuse them without having to generate their own thumbnails.
Vignette can typically be used in file managers, image browsers, etc.
Thumbnails are not limited to image files on disk but can be generated for other file types, for example videos or documents but also for any URL, for example a web browser could store thumbnails for recently visited pages or bookmarks.
Vignette by itself can only generate thumbnails for local files but can retrieve thumbnail for any file or URL, if another app generated a thumbnail for it. An app can also generate a thumbnail by its own means and use vignette to push that thumbnail to the store.
The range of files for which vignette can generate thumbnails depends on plugins as it supports third-party libraries and tools. For example, if the evince-thumbnailer command is installed, it will be able to generate thumbnails for PDF files.
From PyPI <https://pypi.org/project/vignette/>
_::
pip install vignette
The documentation can be read online <https://vignette.readthedocs.io/>
_.
This library has querying functions, that do not generate thumbnails, and can be used with files or URLs, that can be non-images:
It has functions that have side effects, which write thumbnails, or "fail-files" (if a thumbnail couldn't be generated), they can require local-files (see the function's doc):
Just ask for thumbnails of local images, automatically creating them if necessary::
import vignette
thumb_image = vignette.get_thumbnail('/my/file.jpg') local_app_display(thumb_image)
Ask for a thumbnail or generate it manually, for example a web-browser generating pages previews, that this module can't do itself::
import vignette
orig_url = 'http://example.com/file.pdf' thumb_image = vignette.try_get_thumbnail(orig_url, mtime=0) # mtime is not used in this example
if not thumb_image: thumb_image = vignette.build_thumbnail_path(orig_url, 'large') try: local_app_make_preview(orig_url, thumb_image) except NetworkError: vignette.put_fail(orig_url, 'mybrowser-1.0', mtime=0) else: thumb_image = vignette.put_thumbnail(orig_url, 'large', mtime=0) if is_thumbnail_failed(orig_url): thumb_image = 'error.png'
local_app_display(thumb_image)
Vignette works with both Python 2 and Python 3.
Vignette requires at least one image backend to work properly. See the backends section below.
Vignette does not contain image format code. In order to generate a thumbnail from an image or update metadata as required by the Freedestkop standard, vignette uses external libraries. The dependencies are "lazy" though: if an external library is missing, vignette ignores it and falls back on other equivalent libs.
Backends are divided in 2 types:
Vignette currently has thumbnail/metadata backends supporting:
One of these libraries is required for vignette to work in basic cases (thumbnailing local images).
Vignette has additional thumbnail backends to support these tools:
ffmpegthumbnailer <https://github.com/dirkvdb/ffmpegthumbnailer/>
_, supporting video filesoggThumb <https://sourceforge.net/projects/oggvideotools/>
_, supporting OGG video filespdftocairo
from poppler-utils <https://poppler.freedesktop.org/>
_, supporting PDF documentsevince-thumbnailer <https://wiki.gnome.org/Apps/Evince>
_, supporting PDF documentsatril-thumbnailer <https://mate-desktop.org/>
_, supporting PDF documentsooo-thumbnailer <https://launchpad.net/ooo-thumbnailer>
_, supporting OpenOffice documentsIf a lib is not present, vignette continues to operate but thumbnails for certain file formats may not be generated.
Vignette is licensed under the WTFPLv2 <http://wtfpl.net>
_.
.. $version
Vignette is currently at version 5.0.0 and uses Semantic Versioning <http://semver.org/>
_.
Version | Tag | Published |
---|---|---|
5.0.0 | 8mos ago | |
4.5.2 | 3yrs ago | |
4.5.1 | 3yrs ago | |
4.4.0 | 4yrs ago |