Table des matières

Sujet précédent

5.16.5. thumbnailers.pil — thumbnailer for image files

Sujet suivant

5.16.7. thumbnailers.sw — Thumbnailer for SolidWorks files

Cette page

Autres langues

5.16.6. thumbnailers.png — Thumbnailer for files containing a PNG thumbnail

Introduit dans la version 1.1.

This module adds an optimist thumbnailer for some files which contain a PNG thumbnails.

These formats are:

  • Google Sketch Up (skp)

5.16.6.1. How it works

Some files may contain a thumbnail. This thumbnail is stored somewhere in the file as a PNG image. So the idea is to try to find a PNG image in the original file and hope it is a valid image (and the thumbnail).

All PNG file starts with a magic number (89 50 4E 47 0D 0A 1A 0A). This thumbnailer locates this magic number and tries to read the image with PIL. If it succeeds, it assumes it is the thumbnail. If it fails, it tries to find another magic number and retries.

plmapp.thumbnailers.pngthumbnailer.png_thumbnailer(input_path, original_filename, output_path)[source]

Thumbnailer for files which contain a PNG thumbnail.