mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Updated example in light of #3203
This commit is contained in:
parent
3efe34463e
commit
533c907329
|
@ -245,17 +245,14 @@ Reading local images
|
||||||
|
|
||||||
The GIF loader creates an image memory the same size as the GIF file’s *logical
|
The GIF loader creates an image memory the same size as the GIF file’s *logical
|
||||||
screen size*, and pastes the actual pixel data (the *local image*) into this
|
screen size*, and pastes the actual pixel data (the *local image*) into this
|
||||||
image. If you only want the actual pixel rectangle, you can manipulate the
|
image. If you only want the actual pixel rectangle, you can crop the image::
|
||||||
:py:attr:`~PIL.Image.Image.size` and :py:attr:`~PIL.ImageFile.ImageFile.tile`
|
|
||||||
attributes before loading the file::
|
|
||||||
|
|
||||||
im = Image.open(...)
|
im = Image.open(...)
|
||||||
|
|
||||||
if im.tile[0][0] == "gif":
|
if im.tile[0][0] == "gif":
|
||||||
# only read the first "local image" from this GIF file
|
# only read the first "local image" from this GIF file
|
||||||
tag, (x0, y0, x1, y1), offset, extra = im.tile[0]
|
box = im.tile[0][1]
|
||||||
im.size = (x1 - x0, y1 - y0)
|
im = im.crop(box)
|
||||||
im.tile = [(tag, (0, 0) + im.size, offset, extra)]
|
|
||||||
|
|
||||||
ICNS
|
ICNS
|
||||||
^^^^
|
^^^^
|
||||||
|
|
Loading…
Reference in New Issue
Block a user