Re: My viewer for 3DTV #software #viewing


I am not sure whether Linux, as an operating system, provides resources for handling thumbnails, or is it only a task of the installed programs.

For the thumbnails being small image stored in the metadata of the photo file, it is a part of the EXIF specification, but you know this.
For "system-wise" thumbnails, it depends on how wide is your definition of an operating system ;-)

Some programs generate their own thumbnails for different purposes. To avoid to have a large quantity of thumbnails stored on the disk for the same files generated by each used program (not only for images by the way, file browsers can generate thumbnails for other documents), there is a specification proposed by freedesktop (the project promoting interoperability for free-software desktop environments) which explains how to manage thumbnails for documents, so that the first program that sees the file can generate a thumbnail and other programs can use it. There are also rules to store some shared metadata and procedures to invalidate the thumbnail and regenerate it. Of course, this is valid only for programs that choose to follow it.

On Visor3DTV, if you do not want to generate thumbnails, you could nonetheless search for the thumbnails maybe generated by other programs (such as the file manager) as a fallback.
Simple example: (can be enhanced)
def get_thumb_path(f):
    p = os.environ['XDG_CACHE_HOME'] if 'XDG_CACHE_HOME' in os.environ else (os.environ['HOME']+'/.cache')
    p += '/thumbnails/large/'
    p += hashlib.md5(b'file://' + os.path.realpath(os.path.expanduser(os.path.expandvars(f))).encode('utf-8')).hexdigest()
    p += '.png'
    return p
You might want to add some other checks, such as if the path in the metadata of this thumbnail corresponds to the image, and if the modification time of the file is not more recent than the date stored in the metadata of the thumbnail, and fallback to normal folder instead of large if the thumbnail is not present. More details in


Join to automatically receive all group messages.