Skip to main content

File thumbnailer for images, pdfs and more

Project description

File thumbnailer

File thumbnailer is "saner" file thumbnailer with as little weird depedencies as possible

Tox tests

Supported file formats

Supported file formats are all images supported by Pillow OOTB and all files supported by PyMuPDF (if installed)

Installation

PIP (pip3 on some distros)

$ pip install file-thumbnailer
$ pip install file-thumbnailer[pdf] # for PyMuPDF support

Repository

You can also use these repositories maintained by me

Debian and derivates

Add repository by running these commands

$ wget -O- https://repository.salamek.cz/deb/salamek.gpg | sudo tee /usr/share/keyrings/salamek-archive-keyring.gpg
$ echo "deb     [signed-by=/usr/share/keyrings/salamek-archive-keyring.gpg] https://repository.salamek.cz/deb/pub all main" | sudo tee /etc/apt/sources.list.d/salamek.cz.list

And then you can install a package python3-file-thumbnailer

$ apt update && apt install python3-file-thumbnailer

Usage

from file_thumbnailer.ConverterManager import ConverterManager
from file_thumbnailer.models.Dimensions import Dimensions

converter_manager = ConverterManager()
with open('my_file.pdf', 'rb') as read_file:
    converter = converter_manager.from_data(read_file
    thumbnail = converter.to_image_bytes(Dimensions())
    with open('my_file_thumbnail.jpg', 'wb') as thumbnail_file:
        thumbnail_file.write(thumbnail)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

file-thumbnailer-0.0.9.tar.gz (240.6 kB view details)

Uploaded Source

File details

Details for the file file-thumbnailer-0.0.9.tar.gz.

File metadata

  • Download URL: file-thumbnailer-0.0.9.tar.gz
  • Upload date:
  • Size: 240.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for file-thumbnailer-0.0.9.tar.gz
Algorithm Hash digest
SHA256 c19a8621b48ec34153b34b887e78d8cb7dfbc254a9e274809955099d32a4a1fc
MD5 dcde3a05b208fac7d684c51b557c3386
BLAKE2b-256 92e8307a41679e2b0cc6453a8c00b80697c09fb8130fa6cd6356cb2970d1f9d7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page