Skip to main content

A collection of utilities and processors for the Python Imaging Library.

Project description

PILKit is a collection of utilities for working with PIL (the Python Imaging Library).

One of its main features is a set of processors which expose a simple interface for performing manipulations on PIL images.

Looking for more advanced processors? Check out Instakit!

For the complete documentation on the latest stable version of PILKit, see PILKit on RTD.

https://github.com/matthewwithanm/pilkit/workflows/Python%20CI/badge.svg

Installation

  1. Install PIL or Pillow.

  2. Run pip install pilkit (or clone the source and put the pilkit module on your path)

Usage Overview

Processors

The “pilkit.processors” module contains several classes for processing PIL images, which provide an easy to understand API:

from pilkit.processors import ResizeToFit

img = Image.open('/path/to/my/image.png')
processor = ResizeToFit(100, 100)
new_img = processor.process(img)

A few of the included processors are:

  • ResizeToFit

  • ResizeToFill

  • SmartResize

  • Adjust

  • TrimBorderColor

  • Transpose

There’s also a ProcessorPipeline class for executing processors sequentially:

from pilkit.processors import ProcessorPipeline, ResizeToFit, Adjust

img = Image.open('/path/to/my/image.png')
processor = ProcessorPipeline([Adjust(color=0), ResizeToFit(100, 100)])
new_image = processor.process(img)

Utilities

In addition to the processors, PILKit contains a few utilities to ease the pain of working with PIL. Some examples:

prepare_image

Prepares the image for saving to the provided format by doing some common-sense conversions, including preserving transparency and quantizing.

save_image

Wraps PIL’s Image.save() method in order to gracefully handle PIL’s “Suspension not allowed here” errors, and (optionally) prepares the image using prepare_image

Utilities are also included for converting between formats, extensions, and mimetypes.

Community

Please use the GitHub issue tracker to report bugs. A mailing list also exists to discuss the project and ask questions, as well as the official #imagekit channel on Freenode. (Both of these are shared with the django-imagekit project—from which PILKit spun off.)

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

pilkit-3.0.tar.gz (402.3 kB view details)

Uploaded Source

Built Distribution

pilkit-3.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file pilkit-3.0.tar.gz.

File metadata

  • Download URL: pilkit-3.0.tar.gz
  • Upload date:
  • Size: 402.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pilkit-3.0.tar.gz
Algorithm Hash digest
SHA256 f6719e8cc0482e5447f5cb94f18b949d8e604ea9673a9b019c74d41b779e4eab
MD5 a0cf00e63220df3d51d4286e614088d0
BLAKE2b-256 b9a5bbe12d2c9dc06e29224c45a2cd7aa0ce923648588b6a15aadfee150bbd0c

See more details on using hashes here.

File details

Details for the file pilkit-3.0-py3-none-any.whl.

File metadata

  • Download URL: pilkit-3.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pilkit-3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe1707b0411a1d0cbf9ad3986779fa5a346cec4582a188740924aa39f504d117
MD5 18729245634f640716f536d7db7d39f5
BLAKE2b-256 deec877b84b82cbcba6203e39d068cecfdbcfb61de69260cb851ea11be9b67f3

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