mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-11 17:56:18 +03:00
aa263857f3
A while back somebody awesome forked the PIL Handbook (http://effbot.org/imagingbook/pil-index.htm) to Pillow. IIRC we tried to incorporate the handbook "seemlessly", which apparently meant not using the word "handbook" anywhere. Now that seems confusing, so I'm reorganizing all the handbook content under one section named "Handbook". This commit: - Moves guides.rst to handbook/index.rst - Moves appendices.rst to handbook/ - Removes developer.rst from handbook index. - Removes porting-pil-to-pillow.rst from handbook index. Unrelated to the above: - Shorten title "Porting existing PIL-based code to Pillow" to "Porting" - Move text "Porting existing PIL-based code to Pillow" to faux sub-header (bold text not sub-header because there's only one section.) "Porting" may be better named "Migrating", not sure yet.
30 lines
961 B
ReStructuredText
30 lines
961 B
ReStructuredText
Porting
|
|
=======
|
|
|
|
**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
|
|
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
|
|
|
|
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.
|