mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Fixed im.frombytes() for images with a zero dimension
This commit is contained in:
parent
5071692039
commit
91f115bead
|
@ -910,6 +910,9 @@ class TestImage:
|
||||||
def test_zero_frombytes(self, size):
|
def test_zero_frombytes(self, size):
|
||||||
Image.frombytes("RGB", size, b"")
|
Image.frombytes("RGB", size, b"")
|
||||||
|
|
||||||
|
im = Image.new("RGB", size)
|
||||||
|
im.frombytes(b"")
|
||||||
|
|
||||||
def test_has_transparency_data(self):
|
def test_has_transparency_data(self):
|
||||||
for mode in ("1", "L", "P", "RGB"):
|
for mode in ("1", "L", "P", "RGB"):
|
||||||
im = Image.new(mode, (1, 1))
|
im = Image.new(mode, (1, 1))
|
||||||
|
|
|
@ -791,6 +791,9 @@ class Image:
|
||||||
but loads data into this image instead of creating a new image object.
|
but loads data into this image instead of creating a new image object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if self.width == 0 or self.height == 0:
|
||||||
|
return
|
||||||
|
|
||||||
# may pass tuple instead of argument list
|
# may pass tuple instead of argument list
|
||||||
if len(args) == 1 and isinstance(args[0], tuple):
|
if len(args) == 1 and isinstance(args[0], tuple):
|
||||||
args = args[0]
|
args = args[0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user