mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Merge pull request #2507 from radarhere/references
Updated doc references to point to existing files
This commit is contained in:
commit
39240b8af8
|
@ -2529,7 +2529,7 @@ Pre-fork
|
||||||
|
|
||||||
import numpy, Image
|
import numpy, Image
|
||||||
|
|
||||||
im = Image.open('lena.jpg')
|
im = Image.open('hopper.jpg')
|
||||||
|
|
||||||
a = numpy.asarray(im) # a is readonly
|
a = numpy.asarray(im) # a is readonly
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ To load an image from a file, use the :py:func:`~PIL.Image.open` function
|
||||||
in the :py:mod:`~PIL.Image` module::
|
in the :py:mod:`~PIL.Image` module::
|
||||||
|
|
||||||
>>> from PIL import Image
|
>>> from PIL import Image
|
||||||
>>> im = Image.open("lena.ppm")
|
>>> im = Image.open("hopper.ppm")
|
||||||
|
|
||||||
If successful, this function returns an :py:class:`~PIL.Image.Image` object.
|
If successful, this function returns an :py:class:`~PIL.Image.Image` object.
|
||||||
You can now use instance attributes to examine the file contents::
|
You can now use instance attributes to examine the file contents::
|
||||||
|
@ -276,7 +276,7 @@ Converting between modes
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
im = Image.open("lena.ppm").convert("L")
|
im = Image.open("hopper.ppm").convert("L")
|
||||||
|
|
||||||
The library supports transformations between each supported mode and the “L”
|
The library supports transformations between each supported mode and the “L”
|
||||||
and “RGB” modes. To convert between other modes, you may have to use an
|
and “RGB” modes. To convert between other modes, you may have to use an
|
||||||
|
@ -435,8 +435,8 @@ Drawing Postscript
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from PIL import PSDraw
|
from PIL import PSDraw
|
||||||
|
|
||||||
im = Image.open("lena.ppm")
|
im = Image.open("hopper.ppm")
|
||||||
title = "lena"
|
title = "hopper"
|
||||||
box = (1*72, 2*72, 7*72, 10*72) # in points
|
box = (1*72, 2*72, 7*72, 10*72) # in points
|
||||||
|
|
||||||
ps = PSDraw.PSDraw() # default is sys.stdout
|
ps = PSDraw.PSDraw() # default is sys.stdout
|
||||||
|
@ -459,7 +459,7 @@ As described earlier, the :py:func:`~PIL.Image.open` function of the
|
||||||
:py:mod:`~PIL.Image` module is used to open an image file. In most cases, you
|
:py:mod:`~PIL.Image` module is used to open an image file. In most cases, you
|
||||||
simply pass it the filename as an argument::
|
simply pass it the filename as an argument::
|
||||||
|
|
||||||
im = Image.open("lena.ppm")
|
im = Image.open("hopper.ppm")
|
||||||
|
|
||||||
If everything goes well, the result is an :py:class:`PIL.Image.Image` object.
|
If everything goes well, the result is an :py:class:`PIL.Image.Image` object.
|
||||||
Otherwise, an :exc:`IOError` exception is raised.
|
Otherwise, an :exc:`IOError` exception is raised.
|
||||||
|
@ -473,7 +473,7 @@ Reading from an open file
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
fp = open("lena.ppm", "rb")
|
fp = open("hopper.ppm", "rb")
|
||||||
im = Image.open(fp)
|
im = Image.open(fp)
|
||||||
|
|
||||||
To read an image from string data, use the :py:class:`~StringIO.StringIO`
|
To read an image from string data, use the :py:class:`~StringIO.StringIO`
|
||||||
|
@ -499,9 +499,9 @@ Reading from a tar archive
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
from PIL import TarIO
|
from PIL import Image, TarIO
|
||||||
|
|
||||||
fp = TarIO.TarIO("Imaging.tar", "Imaging/test/lena.ppm")
|
fp = TarIO.TarIO("Tests/images/hopper.tar", "hopper.jpg")
|
||||||
im = Image.open(fp)
|
im = Image.open(fp)
|
||||||
|
|
||||||
Controlling the decoder
|
Controlling the decoder
|
||||||
|
|
|
@ -20,7 +20,7 @@ Example: Draw a gray cross over an image
|
||||||
|
|
||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
|
|
||||||
im = Image.open("lena.pgm")
|
im = Image.open("hopper.jpg")
|
||||||
|
|
||||||
draw = ImageDraw.Draw(im)
|
draw = ImageDraw.Draw(im)
|
||||||
draw.line((0, 0) + im.size, fill=128)
|
draw.line((0, 0) + im.size, fill=128)
|
||||||
|
@ -81,7 +81,7 @@ Example: Draw Partial Opacity Text
|
||||||
|
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
# get an image
|
# get an image
|
||||||
base = Image.open('Pillow/Tests/images/lena.png').convert('RGBA')
|
base = Image.open('Pillow/Tests/images/hopper.png').convert('RGBA')
|
||||||
|
|
||||||
# make a blank image for the text, initialized to transparent text color
|
# make a blank image for the text, initialized to transparent text color
|
||||||
txt = Image.new('RGBA', base.size, (255,255,255,0))
|
txt = Image.new('RGBA', base.size, (255,255,255,0))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user