Pillow/README.rst

212 lines
7.1 KiB
ReStructuredText
Raw Normal View History

2013-06-14 08:20:46 +04:00
Pillow
2010-07-31 06:52:47 +04:00
======
2013-10-02 21:06:24 +04:00
*Python Imaging Library (Fork)*
2013-10-02 15:06:12 +04:00
Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
2013-06-30 03:30:52 +04:00
2013-03-07 02:55:43 +04:00
.. image:: https://travis-ci.org/python-imaging/Pillow.png
2013-03-21 22:02:21 +04:00
:target: https://travis-ci.org/python-imaging/Pillow
2013-03-07 02:55:43 +04:00
.. image:: https://pypip.in/v/Pillow/badge.png
:target: https://pypi.python.org/pypi/Pillow/
:alt: Latest PyPI version
.. image:: https://pypip.in/d/Pillow/badge.png
:target: https://pypi.python.org/pypi/Pillow/
:alt: Number of PyPI downloads
The full documentation is hosted at http://pillow.readthedocs.org/. It
contains everything in this file plus tutorials, reference, compatibility
details, and more.
2013-09-30 14:20:44 +04:00
Introduction
------------
2013-09-30 14:15:56 +04:00
.. Note:: Pillow >= 2.1.0 no longer supports "import _imaging". Please use "from PIL.Image import core as _imaging" instead.
2010-07-31 07:03:01 +04:00
2013-09-30 14:20:44 +04:00
.. Note:: Pillow < 2.0.0 supports Python versions 2.4, 2.5, 2.6, 2.7; Pillow >= 2.0.0 supports Python versions 2.6, 2.7, 3.2, 3.3.
2010-07-31 07:03:01 +04:00
2013-02-27 21:50:29 +04:00
The fork author's goal is to foster active development of PIL through:
2010-07-31 07:03:53 +04:00
2013-05-12 04:51:46 +04:00
- Continuous integration testing via `Travis CI <https://travis-ci.org/python-imaging/Pillow>`_
- Publicized development activity on `GitHub <https://github.com/python-imaging/Pillow>`_
- Regular releases to the `Python Package Index <https://pypi.python.org/pypi/Pillow>`_
- Solicitation for community contributions and involvement on `Image-SIG <http://mail.python.org/mailman/listinfo/image-sig>`_
2011-09-07 22:10:25 +04:00
For information about why this fork exists and how it differs from PIL, see
`the About page in the documentation`_.
2011-10-27 05:12:43 +04:00
.. _the About page in the documentation: http://pillow.readthedocs.org/en/latest/about.html
2013-03-08 17:40:36 +04:00
2013-06-30 03:30:52 +04:00
Installation
------------
.. Note:: PIL and Pillow currently cannot co-exist in the same environment. If you want to use Pillow, please remove PIL first.
2013-09-28 19:00:39 +04:00
You can install Pillow with ``pip``::
2013-06-30 03:30:52 +04:00
$ pip install Pillow
2013-09-28 19:19:03 +04:00
Or ``easy_install`` (for installing `Python Eggs <http://peak.telecommunity.com/DevCenter/PythonEggs>`_, as pip does not support them)::
2013-09-28 19:00:39 +04:00
$ easy_install Pillow
Or download the compressed archive from PyPI, extract it, and inside it run::
$ python setup.py install
For more information, please see http://pillow.readthedocs.org/en/latest/ or below.
2013-09-28 18:42:28 +04:00
Community Support
-----------------
Developer
~~~~~~~~~
2013-03-09 02:35:40 +04:00
2013-05-12 04:55:06 +04:00
PIL needs you! Please help us maintain the Python Imaging Library here:
2013-03-09 02:35:40 +04:00
2013-05-12 04:55:06 +04:00
- GitHub (https://github.com/python-imaging/Pillow)
- Freenode (irc://irc.freenode.net#pil)
- Image-SIG (http://mail.python.org/mailman/listinfo/image-sig)
2013-03-09 02:35:40 +04:00
2013-09-28 18:42:28 +04:00
Financial
~~~~~~~~~
2013-06-30 03:30:52 +04:00
2013-09-28 19:14:05 +04:00
Pillow is a volunteer effort led by Alex Clark. If you can't help with development, please help us financially; your assistance is very much needed and appreciated!
2013-06-30 03:30:52 +04:00
2013-09-28 18:42:28 +04:00
.. Note:: Contributors: please add your name and donation preference here.
2013-06-30 03:30:52 +04:00
+--------------------------------------+---------------------------------------+
| **Developer** | **Preference** |
+--------------------------------------+---------------------------------------+
| Alex Clark (fork author) | http://gittip.com/aclark4life |
+--------------------------------------+---------------------------------------+
2013-09-28 18:44:12 +04:00
Developer Notes
---------------
2013-05-16 00:54:49 +04:00
2013-06-30 03:52:23 +04:00
.. Note:: If there is a binary package for your system, that is the easiest way to install Pillow. Currently we only provide binaries for Windows (via Python eggs).
2013-06-30 03:47:36 +04:00
Build from source
~~~~~~~~~~~~~~~~~
2013-10-02 14:44:46 +04:00
Many of Pillow's features require external libraries:
2013-06-30 03:47:36 +04:00
* **libjpeg** provides JPEG functionality.
* Pillow has been tested with libjpeg versions **6b**, **8**, and **9**
* **zlib** provides access to compressed PNGs
* **libtiff** provides group4 tiff functionality
* Pillow has been tested with libtiff versions **3.x** and **4.0**
* **libfreetype** provides type related services
* **littlecms** provides color management
2013-06-30 03:47:36 +04:00
* **libwebp** provides the Webp format.
* Pillow has been tested with version **0.1.3**, which does not read transparent webp files. Version **0.3.0** supports transparency.
2013-06-30 03:47:36 +04:00
* **tcl/tk** provides support for tkinter bitmap and photo images.
If the prerequisites are installed in the standard library locations for your machine (e.g. /usr or /usr/local), no additional configuration should be required. If they are installed in a non-standard location, you may need to configure setuptools to use those locations (i.e. by editing setup.py and/or setup.cfg). Once you have installed the prerequisites, run::
2013-06-30 03:47:36 +04:00
$ pip install Pillow
2013-05-04 04:48:33 +04:00
Platform-specific instructions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2013-03-19 09:39:30 +04:00
2013-05-04 05:10:54 +04:00
Linux
+++++
**We do not provide binaries for Linux.** If you didn't build Python from source, make sure you have Python's development libraries installed. In Debian or Ubuntu::
2013-05-04 05:10:54 +04:00
$ sudo apt-get install python-dev python-setuptools
Or for Python 3::
$ sudo apt-get install python3-dev python3-setuptools
Prerequisites are installed on **Ubuntu 10.04 LTS** with::
$ sudo apt-get install libtiff4-dev libjpeg62-dev zlib1g-dev libfreetype6-dev liblcms1-dev tcl8.5-dev tk8.5-dev
2013-05-04 05:10:54 +04:00
2013-08-22 01:54:48 +04:00
Prerequisites are installed with on **Ubuntu 12.04 LTS** or **Raspian Wheezy 7.0** with::
2013-05-04 05:10:54 +04:00
$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms1-dev libwebp-dev tcl8.5-dev tk8.5-dev
2013-05-04 05:10:54 +04:00
2013-10-04 15:13:14 +04:00
Distributions
^^^^^^^^^^^^^
.. Note:: XXX Provide links
Additionally, many Linux distributions now include Pillow (instead of PIL) with their distribution:
- Fedora
- Debian/Ubuntu
- ArchLinux
2013-05-04 04:11:39 +04:00
Mac OS X
++++++++
2013-05-04 04:11:39 +04:00
**We do not provide binaries for OS X.** So you'll need XCode to install Pillow. (XCode 4.2 on 10.6 will work with the Official Python binary distribution. Otherwise, use whatever XCode you used to compile Python.)
2013-04-09 23:43:23 +04:00
2013-06-30 03:45:53 +04:00
The easiest way to install the prerequisites is via `Homebrew <http://mxcl.github.com/homebrew/>`_. After you install Homebrew, run::
2013-04-09 23:43:23 +04:00
2013-05-04 04:20:13 +04:00
$ brew install libtiff libjpeg webp littlecms
2013-04-09 23:43:23 +04:00
2013-06-30 03:45:53 +04:00
If you've built your own Python, then you should be able to install Pillow using::
2013-04-09 23:43:23 +04:00
2013-05-04 05:01:59 +04:00
$ pip install Pillow
2013-03-19 09:39:30 +04:00
2013-04-09 23:25:55 +04:00
Windows
+++++++
2013-03-19 09:39:30 +04:00
2013-10-02 15:09:49 +04:00
We provide binaries for Windows in the form of Python Eggs and `Python Wheels <http://wheel.readthedocs.org/en/latest/index.html>`_:
Python Eggs
^^^^^^^^^^^
.. Note:: Pip does not support Python Eggs; use easy_install instead.
2013-06-30 03:45:53 +04:00
::
2013-05-04 05:10:54 +04:00
2013-06-30 03:45:53 +04:00
$ easy_install Pillow
2013-05-04 04:11:39 +04:00
Python Wheels
^^^^^^^^^^^^^
2013-10-02 15:07:14 +04:00
.. Note:: Experimental. Requires Setuptools >=0.8 and Pip >=1.4.1
::
$ pip install --use-wheel Pillow
2013-06-30 03:52:23 +04:00
Platform support
~~~~~~~~~~~~~~~~
Current platform support for Pillow is documented here:
http://pillow.readthedocs.org/en/latest/installation.html#platform-support
2013-06-30 03:52:23 +04:00
2013-06-30 03:30:52 +04:00
Port existing PIL-based code to Pillow
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2013-04-03 04:19:13 +04:00
2013-06-30 03:30:52 +04:00
Pillow is a functional drop-in replacement for the Python Imaging Library. To run your existing PIL-compatible code with Pillow, it needs to be modified to import the ``Imaging`` module from the ``PIL`` namespace *instead* of the global namespace. I.e. change::
2013-04-03 04:19:13 +04:00
2013-06-30 03:30:52 +04:00
import Image
2013-04-03 04:19:13 +04:00
2013-06-30 03:30:52 +04:00
to::
from PIL import Image
.. Note:: If your code imports from ``_imaging``, it will no longer work.
The preferred, future proof method of importing the private ``_imaging`` module is::
from PIL import Image
_imaging = Image.core