Skip to main content

A collection of useful tools for python pillow and ffmpy

Project description

pillow-tools

A collection of useful tools for python pillow and ffmpy.

Install

pip install pillow-tools

Create a thumbnail

You can create a smaller version of an image (including .gif) while maintaining the aspect ratio.

from pillow_tools import OptimizeToSize

imagePath = '/dir/image.png'
thumbPath = OptimizeToSize(imagePath, maxWidth=1280, maxHeight=720)
# The thumbPath image is now in the same directory as imagePath.
# This will scale the image to a new resolution not exceeding the maxWidth/maxHeight but preserving the aspect ratio

print('thumbPath=', thumbPath)

Output

>>> thumbPath= '/dir/image_1280x720.png'

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

pillow_tools-1.1.2.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

pillow_tools-1.1.2-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

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