Pillow/docs/porting-pil-to-pillow.rst

28 lines
982 B
ReStructuredText
Raw Normal View History

Porting existing PIL-based code to Pillow
=========================================
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
2014-01-19 20:52:21 +04:00
import the ``Image`` module from the ``PIL`` namespace *instead* of the
global namespace. Change this::
import Image
to this::
from PIL import Image
The :py:mod:`_imaging` module has been moved. You can now import it like this::
from PIL.Image import core as _imaging
2014-01-19 20:52:21 +04:00
The image plugin loading mechanism has changed. Pillow no longer
automatically imports any file in the Python path with a name ending
in :file:`ImagePlugin.py`. You will need to import your image plugin
manually.
Pillow will raise an exception if the core extension can't be loaded
for any reason, including a version mismatch between the Python and
extension code. Previously PIL allowed Python only code to run if the
core extension was not available.