| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: pilkit |
| 3 |
Version: 3.0 |
| 4 |
Summary: A collection of utilities and processors for the Python Imaging Library. |
| 5 |
Home-page: http://github.com/matthewwithanm/pilkit/ |
| 6 |
Author: Matthew Tretter |
| 7 |
Author-email: [email protected] |
| 8 |
License: BSD |
| 9 |
Classifier: Development Status :: 5 - Production/Stable |
| 10 |
Classifier: Intended Audience :: Developers |
| 11 |
Classifier: License :: OSI Approved :: BSD License |
| 12 |
Classifier: Operating System :: OS Independent |
| 13 |
Classifier: Programming Language :: Python :: 3.6 |
| 14 |
Classifier: Programming Language :: Python :: 3.7 |
| 15 |
Classifier: Programming Language :: Python :: 3.8 |
| 16 |
Classifier: Programming Language :: Python :: 3.9 |
| 17 |
Classifier: Programming Language :: Python :: 3.10 |
| 18 |
Classifier: Programming Language :: Python :: 3.11 |
| 19 |
Classifier: Topic :: Utilities |
| 20 |
License-File: LICENSE |
| 21 |
License-File: AUTHORS |
| 22 |
Requires-Dist: Pillow>=7.0 |
| 23 |
|
| 24 |
PILKit is a collection of utilities for working with PIL (the Python Imaging |
| 25 |
Library). |
| 26 |
|
| 27 |
One of its main features is a set of **processors** which expose a simple |
| 28 |
interface for performing manipulations on PIL images. |
| 29 |
|
| 30 |
Looking for more advanced processors? Check out `Instakit`_! |
| 31 |
|
| 32 |
**For the complete documentation on the latest stable version of PILKit, see** |
| 33 |
`PILKit on RTD`_. |
| 34 |
|
| 35 |
.. image:: https://github.com/matthewwithanm/pilkit/workflows/Python%20CI/badge.svg |
| 36 |
:target: https://github.com/matthewwithanm/pilkit/actions?query=workflow%3A%22Python+CI%22 |
| 37 |
|
| 38 |
.. _`PILKit on RTD`: http://pilkit.readthedocs.org |
| 39 |
.. _`Instakit`: https://github.com/fish2000/instakit |
| 40 |
|
| 41 |
|
| 42 |
Installation |
| 43 |
============ |
| 44 |
|
| 45 |
1. Install `PIL`_ or `Pillow`_. |
| 46 |
2. Run ``pip install pilkit`` (or clone the source and put the pilkit module on |
| 47 |
your path) |
| 48 |
|
| 49 |
.. note:: If you've never seen Pillow before, it considers itself a |
| 50 |
more-frequently updated "friendly" fork of PIL that's compatible with |
| 51 |
setuptools. As such, it shares the same namespace as PIL does and is a |
| 52 |
drop-in replacement. |
| 53 |
|
| 54 |
.. _`PIL`: http://pypi.python.org/pypi/PIL |
| 55 |
.. _`Pillow`: http://pypi.python.org/pypi/Pillow |
| 56 |
|
| 57 |
|
| 58 |
Usage Overview |
| 59 |
============== |
| 60 |
|
| 61 |
|
| 62 |
Processors |
| 63 |
---------- |
| 64 |
|
| 65 |
The "pilkit.processors" module contains several classes for processing PIL |
| 66 |
images, which provide an easy to understand API: |
| 67 |
|
| 68 |
.. code-block:: python |
| 69 |
|
| 70 |
from pilkit.processors import ResizeToFit |
| 71 |
|
| 72 |
img = Image.open('/path/to/my/image.png') |
| 73 |
processor = ResizeToFit(100, 100) |
| 74 |
new_img = processor.process(img) |
| 75 |
|
| 76 |
A few of the included processors are: |
| 77 |
|
| 78 |
* ``ResizeToFit`` |
| 79 |
* ``ResizeToFill`` |
| 80 |
* ``SmartResize`` |
| 81 |
* ``Adjust`` |
| 82 |
* ``TrimBorderColor`` |
| 83 |
* ``Transpose`` |
| 84 |
|
| 85 |
There's also a ``ProcessorPipeline`` class for executing processors |
| 86 |
sequentially: |
| 87 |
|
| 88 |
.. code-block:: python |
| 89 |
|
| 90 |
from pilkit.processors import ProcessorPipeline, ResizeToFit, Adjust |
| 91 |
|
| 92 |
img = Image.open('/path/to/my/image.png') |
| 93 |
processor = ProcessorPipeline([Adjust(color=0), ResizeToFit(100, 100)]) |
| 94 |
new_image = processor.process(img) |
| 95 |
|
| 96 |
|
| 97 |
Utilities |
| 98 |
--------- |
| 99 |
|
| 100 |
In addition to the processors, PILKit contains a few utilities to ease the pain |
| 101 |
of working with PIL. Some examples: |
| 102 |
|
| 103 |
``prepare_image`` |
| 104 |
Prepares the image for saving to the provided format by doing some |
| 105 |
common-sense conversions, including preserving transparency and quantizing. |
| 106 |
``save_image`` |
| 107 |
Wraps PIL's ``Image.save()`` method in order to gracefully handle PIL's |
| 108 |
"Suspension not allowed here" errors, and (optionally) prepares the image |
| 109 |
using ``prepare_image`` |
| 110 |
|
| 111 |
Utilities are also included for converting between formats, extensions, and |
| 112 |
mimetypes. |
| 113 |
|
| 114 |
|
| 115 |
Community |
| 116 |
========= |
| 117 |
|
| 118 |
Please use `the GitHub issue tracker <https://github.com/matthewwithanm/pilkit/issues>`_ |
| 119 |
to report bugs. `A mailing list <https://groups.google.com/forum/#!forum/django-imagekit>`_ |
| 120 |
also exists to discuss the project and ask questions, as well as the official |
| 121 |
`#imagekit <irc://irc.freenode.net/imagekit>`_ channel on Freenode. (Both of |
| 122 |
these are shared with the `django-imagekit`_ project—from which PILKit spun |
| 123 |
off.) |
| 124 |
|
| 125 |
.. _`django-imagekit`: https://github.com/jdriscoll/django-imagekit |