mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-23 05:34:45 +03:00
Added is_animated and n_frames to Image
This commit is contained in:
parent
4634eafe3c
commit
e08ab85b41
|
@ -65,6 +65,8 @@ class TestImage:
|
||||||
assert repr(im)[:45] == "<PIL.Image.Image image mode=L size=100x100 at"
|
assert repr(im)[:45] == "<PIL.Image.Image image mode=L size=100x100 at"
|
||||||
assert im.mode == "L"
|
assert im.mode == "L"
|
||||||
assert im.size == (100, 100)
|
assert im.size == (100, 100)
|
||||||
|
assert not im.is_animated
|
||||||
|
assert im.n_frames == 1
|
||||||
|
|
||||||
im = Image.new("RGB", (100, 100))
|
im = Image.new("RGB", (100, 100))
|
||||||
assert repr(im)[:45] == "<PIL.Image.Image image mode=RGB size=100x100 "
|
assert repr(im)[:45] == "<PIL.Image.Image image mode=RGB size=100x100 "
|
||||||
|
|
|
@ -538,6 +538,10 @@ class Image:
|
||||||
self.readonly = 0
|
self.readonly = 0
|
||||||
self.pyaccess = None
|
self.pyaccess = None
|
||||||
self._exif = None
|
self._exif = None
|
||||||
|
if "is_animated" not in dir(self):
|
||||||
|
self.is_animated = False
|
||||||
|
if "n_frames" not in dir(self):
|
||||||
|
self.n_frames = 1
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def width(self):
|
def width(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user