mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
Further health fixes
This commit is contained in:
parent
b33642c361
commit
ee34d6843b
|
@ -288,7 +288,7 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
if s[:11] == "%ImageData:":
|
if s[:11] == "%ImageData:":
|
||||||
# Encoded bitmapped image.
|
# Encoded bitmapped image.
|
||||||
[x, y, bi, mo, z3, z4, en, id] = s[11:].split(None, 7)
|
x, y, bi, mo = s[11:].split(None, 7)[:4]
|
||||||
|
|
||||||
if int(bi) != 8:
|
if int(bi) != 8:
|
||||||
break
|
break
|
||||||
|
|
|
@ -39,8 +39,8 @@ class GbrImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
width = i32(self.fp.read(4))
|
width = i32(self.fp.read(4))
|
||||||
height = i32(self.fp.read(4))
|
height = i32(self.fp.read(4))
|
||||||
bytes = i32(self.fp.read(4))
|
color_depth = i32(self.fp.read(4))
|
||||||
if width <= 0 or height <= 0 or bytes != 1:
|
if width <= 0 or height <= 0 or color_depth != 1:
|
||||||
raise SyntaxError("not a GIMP brush")
|
raise SyntaxError("not a GIMP brush")
|
||||||
|
|
||||||
comment = self.fp.read(header_size - 20)[:-1]
|
comment = self.fp.read(header_size - 20)[:-1]
|
||||||
|
|
|
@ -94,7 +94,7 @@ def read_32(fobj, start_length, size):
|
||||||
|
|
||||||
def read_mk(fobj, start_length, size):
|
def read_mk(fobj, start_length, size):
|
||||||
# Alpha masks seem to be uncompressed
|
# Alpha masks seem to be uncompressed
|
||||||
(start, length) = start_length
|
start = start_length[0]
|
||||||
fobj.seek(start)
|
fobj.seek(start)
|
||||||
pixel_size = (size[0] * size[2], size[1] * size[2])
|
pixel_size = (size[0] * size[2], size[1] * size[2])
|
||||||
sizesq = pixel_size[0] * pixel_size[1]
|
sizesq = pixel_size[0] * pixel_size[1]
|
||||||
|
|
|
@ -322,6 +322,7 @@ class Parser:
|
||||||
image = None
|
image = None
|
||||||
data = None
|
data = None
|
||||||
decoder = None
|
decoder = None
|
||||||
|
offset = 0
|
||||||
finished = 0
|
finished = 0
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
|
|
@ -454,13 +454,13 @@ def _getmp(self):
|
||||||
data = self.info["mp"]
|
data = self.info["mp"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
file = io.BytesIO(data)
|
file_contents = io.BytesIO(data)
|
||||||
head = file.read(8)
|
head = file_contents.read(8)
|
||||||
endianness = '>' if head[:4] == b'\x4d\x4d\x00\x2a' else '<'
|
endianness = '>' if head[:4] == b'\x4d\x4d\x00\x2a' else '<'
|
||||||
mp = {}
|
mp = {}
|
||||||
# process dictionary
|
# process dictionary
|
||||||
info = TiffImagePlugin.ImageFileDirectory(head)
|
info = TiffImagePlugin.ImageFileDirectory(head)
|
||||||
info.load(file)
|
info.load(file_contents)
|
||||||
for key, value in info.items():
|
for key, value in info.items():
|
||||||
mp[key] = _fixup(value)
|
mp[key] = _fixup(value)
|
||||||
# it's an error not to have a number of images
|
# it's an error not to have a number of images
|
||||||
|
|
|
@ -54,9 +54,9 @@ class MicImageFile(TiffImagePlugin.TiffImageFile):
|
||||||
# best way to identify MIC files, but what the... ;-)
|
# best way to identify MIC files, but what the... ;-)
|
||||||
|
|
||||||
self.images = []
|
self.images = []
|
||||||
for file in self.ole.listdir():
|
for path in self.ole.listdir():
|
||||||
if file[1:] and file[0][-4:] == ".ACI" and file[1] == "Image":
|
if path[1:] and path[0][-4:] == ".ACI" and path[1] == "Image":
|
||||||
self.images.append(file)
|
self.images.append(path)
|
||||||
|
|
||||||
# if we didn't find any images, this is probably not
|
# if we didn't find any images, this is probably not
|
||||||
# an MIC file.
|
# an MIC file.
|
||||||
|
|
|
@ -194,7 +194,7 @@ class _PyAccessI16_L(PyAccess):
|
||||||
pixel = self.pixels[y][x]
|
pixel = self.pixels[y][x]
|
||||||
try:
|
try:
|
||||||
color = min(color, 65535)
|
color = min(color, 65535)
|
||||||
except:
|
except TypeError:
|
||||||
color = min(color[0], 65535)
|
color = min(color[0], 65535)
|
||||||
|
|
||||||
pixel.l = color & 0xFF
|
pixel.l = color & 0xFF
|
||||||
|
|
|
@ -48,7 +48,7 @@ def isInt(f):
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
except:
|
except ValueError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
iforms = [1, 3, -11, -12, -21, -22]
|
iforms = [1, 3, -11, -12, -21, -22]
|
||||||
|
@ -173,11 +173,11 @@ class SpiderImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
# returns a byte image after rescaling to 0..255
|
# returns a byte image after rescaling to 0..255
|
||||||
def convert2byte(self, depth=255):
|
def convert2byte(self, depth=255):
|
||||||
(min, max) = self.getextrema()
|
(minimum, maximum) = self.getextrema()
|
||||||
m = 1
|
m = 1
|
||||||
if max != min:
|
if maximum != minimum:
|
||||||
m = depth / (max-min)
|
m = depth / (maximum-minimum)
|
||||||
b = -m * min
|
b = -m * minimum
|
||||||
return self.point(lambda i, m=m, b=b: i * m + b).convert("L")
|
return self.point(lambda i, m=m, b=b: i * m + b).convert("L")
|
||||||
|
|
||||||
# returns a ImageTk.PhotoImage object, after rescaling to 0..255
|
# returns a ImageTk.PhotoImage object, after rescaling to 0..255
|
||||||
|
@ -271,7 +271,7 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
def _save_spider(im, fp, filename):
|
def _save_spider(im, fp, filename):
|
||||||
# get the filename extension and register it with Image
|
# get the filename extension and register it with Image
|
||||||
fn, ext = os.path.splitext(filename)
|
ext = os.path.splitext(filename)[1]
|
||||||
Image.register_extension("SPIDER", ext)
|
Image.register_extension("SPIDER", ext)
|
||||||
_save(im, fp, filename)
|
_save(im, fp, filename)
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from tkinter import *
|
from tkinter import Tk, Toplevel, Frame, Label, Scale, HORIZONTAL
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from Tkinter import *
|
from Tkinter import Tk, Toplevel, Frame, Label, Scale, HORIZONTAL
|
||||||
|
|
||||||
from PIL import Image, ImageTk, ImageEnhance
|
from PIL import Image, ImageTk, ImageEnhance
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from tkinter import *
|
from tkinter import Tk, Canvas, NW
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from Tkinter import *
|
from Tkinter import Tk, Canvas, NW
|
||||||
|
|
||||||
from PIL import Image, ImageTk
|
from PIL import Image, ImageTk
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from tkinter import *
|
from tkinter import Tk, Label
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from Tkinter import *
|
from Tkinter import Tk, Label
|
||||||
|
|
||||||
from PIL import Image, ImageTk
|
from PIL import Image, ImageTk
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,8 @@ post patch:
|
||||||
test_output = BytesIO()
|
test_output = BytesIO()
|
||||||
im.save(test_output, "JPEG", exif=exif)
|
im.save(test_output, "JPEG", exif=exif)
|
||||||
|
|
||||||
"""
|
def test_base_save(self):
|
||||||
|
"""
|
||||||
base case:
|
base case:
|
||||||
MB
|
MB
|
||||||
20.99^ ::::: :::::::::::::::::::::::::::::::::::::::::::@:::
|
20.99^ ::::: :::::::::::::::::::::::::::::::::::::::::::@:::
|
||||||
|
@ -195,8 +196,6 @@ base case:
|
||||||
0 +----------------------------------------------------------------------->Gi
|
0 +----------------------------------------------------------------------->Gi
|
||||||
0 7.882
|
0 7.882
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def test_base_save(self):
|
|
||||||
im = hopper('RGB')
|
im = hopper('RGB')
|
||||||
|
|
||||||
for _ in range(iterations):
|
for _ in range(iterations):
|
||||||
|
|
|
@ -58,10 +58,10 @@ class TestBmpReference(PillowTestCase):
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_compare(f):
|
def get_compare(f):
|
||||||
(head, name) = os.path.split(f)
|
name = os.path.split(f)[1]
|
||||||
if name in file_map:
|
if name in file_map:
|
||||||
return os.path.join(base, 'html', file_map[name])
|
return os.path.join(base, 'html', file_map[name])
|
||||||
(name, ext) = os.path.splitext(name)
|
name = os.path.splitext(name)[0]
|
||||||
return os.path.join(base, 'html', "%s.png" % name)
|
return os.path.join(base, 'html', "%s.png" % name)
|
||||||
|
|
||||||
for f in self.get_files('g'):
|
for f in self.get_files('g'):
|
||||||
|
|
|
@ -5,14 +5,14 @@ from PIL import Image
|
||||||
# sample ppm stream
|
# sample ppm stream
|
||||||
# created as an export of a palette image from Gimp2.6
|
# created as an export of a palette image from Gimp2.6
|
||||||
# save as...-> hopper.fli, default options.
|
# save as...-> hopper.fli, default options.
|
||||||
file = "Tests/images/hopper.fli"
|
test_file = "Tests/images/hopper.fli"
|
||||||
data = open(file, "rb").read()
|
data = open(test_file, "rb").read()
|
||||||
|
|
||||||
|
|
||||||
class TestFileFli(PillowTestCase):
|
class TestFileFli(PillowTestCase):
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
im.load()
|
im.load()
|
||||||
self.assertEqual(im.mode, "P")
|
self.assertEqual(im.mode, "P")
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
|
|
|
@ -36,9 +36,9 @@ class TestFileGif(PillowTestCase):
|
||||||
|
|
||||||
def test_bilevel(optimize):
|
def test_bilevel(optimize):
|
||||||
im = Image.new("1", (1, 1), 0)
|
im = Image.new("1", (1, 1), 0)
|
||||||
file = BytesIO()
|
test_file = BytesIO()
|
||||||
im.save(file, "GIF", optimize=optimize)
|
im.save(test_file, "GIF", optimize=optimize)
|
||||||
return len(file.getvalue())
|
return len(test_file.getvalue())
|
||||||
|
|
||||||
self.assertEqual(test_grayscale(0), 800)
|
self.assertEqual(test_grayscale(0), 800)
|
||||||
self.assertEqual(test_grayscale(1), 38)
|
self.assertEqual(test_grayscale(1), 38)
|
||||||
|
@ -49,8 +49,8 @@ class TestFileGif(PillowTestCase):
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
im = Image.frombytes("L", (16, 16), bytes(bytearray(range(256))))
|
im = Image.frombytes("L", (16, 16), bytes(bytearray(range(256))))
|
||||||
file = BytesIO()
|
test_file = BytesIO()
|
||||||
im.save(file, "GIF", optimize=True)
|
im.save(test_file, "GIF", optimize=True)
|
||||||
self.assertEqual(im.mode, "L")
|
self.assertEqual(im.mode, "L")
|
||||||
|
|
||||||
def test_roundtrip(self):
|
def test_roundtrip(self):
|
||||||
|
|
|
@ -5,8 +5,8 @@ from PIL import Image
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# sample icon file
|
# sample icon file
|
||||||
file = "Tests/images/pillow.icns"
|
test_file = "Tests/images/pillow.icns"
|
||||||
data = open(file, "rb").read()
|
data = open(test_file, "rb").read()
|
||||||
|
|
||||||
enable_jpeg2k = hasattr(Image.core, 'jp2klib_version')
|
enable_jpeg2k = hasattr(Image.core, 'jp2klib_version')
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class TestFileIcns(PillowTestCase):
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
# Loading this icon by default should result in the largest size
|
# Loading this icon by default should result in the largest size
|
||||||
# (512x512@2x) being loaded
|
# (512x512@2x) being loaded
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
im.load()
|
im.load()
|
||||||
self.assertEqual(im.mode, "RGBA")
|
self.assertEqual(im.mode, "RGBA")
|
||||||
self.assertEqual(im.size, (1024, 1024))
|
self.assertEqual(im.size, (1024, 1024))
|
||||||
|
@ -39,11 +39,11 @@ class TestFileIcns(PillowTestCase):
|
||||||
def test_sizes(self):
|
def test_sizes(self):
|
||||||
# Check that we can load all of the sizes, and that the final pixel
|
# Check that we can load all of the sizes, and that the final pixel
|
||||||
# dimensions are as expected
|
# dimensions are as expected
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
for w, h, r in im.info['sizes']:
|
for w, h, r in im.info['sizes']:
|
||||||
wr = w * r
|
wr = w * r
|
||||||
hr = h * r
|
hr = h * r
|
||||||
im2 = Image.open(file)
|
im2 = Image.open(test_file)
|
||||||
im2.size = (w, h, r)
|
im2.size = (w, h, r)
|
||||||
im2.load()
|
im2.load()
|
||||||
self.assertEqual(im2.mode, 'RGBA')
|
self.assertEqual(im2.mode, 'RGBA')
|
||||||
|
|
|
@ -23,10 +23,10 @@ class TestFileJpeg(PillowTestCase):
|
||||||
def roundtrip(self, im, **options):
|
def roundtrip(self, im, **options):
|
||||||
out = BytesIO()
|
out = BytesIO()
|
||||||
im.save(out, "JPEG", **options)
|
im.save(out, "JPEG", **options)
|
||||||
bytes = out.tell()
|
test_bytes = out.tell()
|
||||||
out.seek(0)
|
out.seek(0)
|
||||||
im = Image.open(out)
|
im = Image.open(out)
|
||||||
im.bytes = bytes # for testing only
|
im.bytes = test_bytes # for testing only
|
||||||
return im
|
return im
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
|
|
|
@ -22,10 +22,10 @@ class TestFileJpeg2k(PillowTestCase):
|
||||||
def roundtrip(self, im, **options):
|
def roundtrip(self, im, **options):
|
||||||
out = BytesIO()
|
out = BytesIO()
|
||||||
im.save(out, "JPEG2000", **options)
|
im.save(out, "JPEG2000", **options)
|
||||||
bytes = out.tell()
|
test_bytes = out.tell()
|
||||||
out.seek(0)
|
out.seek(0)
|
||||||
im = Image.open(out)
|
im = Image.open(out)
|
||||||
im.bytes = bytes # for testing only
|
im.bytes = test_bytes # for testing only
|
||||||
im.load()
|
im.load()
|
||||||
return im
|
return im
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
self._assert_noerr(im)
|
self._assert_noerr(im)
|
||||||
|
|
||||||
def test_g4_large(self):
|
def test_g4_large(self):
|
||||||
file = "Tests/images/pport_g4.tif"
|
test_file = "Tests/images/pport_g4.tif"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
self._assert_noerr(im)
|
self._assert_noerr(im)
|
||||||
|
|
||||||
def test_g4_tiff_file(self):
|
def test_g4_tiff_file(self):
|
||||||
|
|
|
@ -18,8 +18,8 @@ class TestFileLibTiffSmall(LibTiffTestCase):
|
||||||
def test_g4_hopper_file(self):
|
def test_g4_hopper_file(self):
|
||||||
"""Testing the open file load path"""
|
"""Testing the open file load path"""
|
||||||
|
|
||||||
file = "Tests/images/hopper_g4.tif"
|
test_file = "Tests/images/hopper_g4.tif"
|
||||||
with open(file, 'rb') as f:
|
with open(test_file, 'rb') as f:
|
||||||
im = Image.open(f)
|
im = Image.open(f)
|
||||||
|
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
|
@ -28,9 +28,9 @@ class TestFileLibTiffSmall(LibTiffTestCase):
|
||||||
def test_g4_hopper_bytesio(self):
|
def test_g4_hopper_bytesio(self):
|
||||||
"""Testing the bytesio loading code path"""
|
"""Testing the bytesio loading code path"""
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
file = "Tests/images/hopper_g4.tif"
|
test_file = "Tests/images/hopper_g4.tif"
|
||||||
s = BytesIO()
|
s = BytesIO()
|
||||||
with open(file, 'rb') as f:
|
with open(test_file, 'rb') as f:
|
||||||
s.write(f.read())
|
s.write(f.read())
|
||||||
s.seek(0)
|
s.seek(0)
|
||||||
im = Image.open(s)
|
im = Image.open(s)
|
||||||
|
@ -41,8 +41,8 @@ class TestFileLibTiffSmall(LibTiffTestCase):
|
||||||
def test_g4_hopper(self):
|
def test_g4_hopper(self):
|
||||||
"""The 128x128 lena image failed for some reason."""
|
"""The 128x128 lena image failed for some reason."""
|
||||||
|
|
||||||
file = "Tests/images/hopper_g4.tif"
|
test_file = "Tests/images/hopper_g4.tif"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
self._assert_noerr(im)
|
self._assert_noerr(im)
|
||||||
|
|
|
@ -17,10 +17,10 @@ class TestFileMpo(PillowTestCase):
|
||||||
# Note that for now, there is no MPO saving functionality
|
# Note that for now, there is no MPO saving functionality
|
||||||
out = BytesIO()
|
out = BytesIO()
|
||||||
im.save(out, "MPO", **options)
|
im.save(out, "MPO", **options)
|
||||||
bytes = out.tell()
|
test_bytes = out.tell()
|
||||||
out.seek(0)
|
out.seek(0)
|
||||||
im = Image.open(out)
|
im = Image.open(out)
|
||||||
im.bytes = bytes # for testing only
|
im.bytes = test_bytes # for testing only
|
||||||
return im
|
return im
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
|
|
|
@ -31,8 +31,8 @@ class TestFilePcx(PillowTestCase):
|
||||||
def test_pil184(self):
|
def test_pil184(self):
|
||||||
# Check reading of files where xmin/xmax is not zero.
|
# Check reading of files where xmin/xmax is not zero.
|
||||||
|
|
||||||
file = "Tests/images/pil184.pcx"
|
test_file = "Tests/images/pil184.pcx"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
self.assertEqual(im.size, (447, 144))
|
self.assertEqual(im.size, (447, 144))
|
||||||
self.assertEqual(im.tile[0][1], (0, 0, 447, 144))
|
self.assertEqual(im.tile[0][1], (0, 0, 447, 144))
|
||||||
|
|
|
@ -19,9 +19,9 @@ MAGIC = PngImagePlugin._MAGIC
|
||||||
|
|
||||||
|
|
||||||
def chunk(cid, *data):
|
def chunk(cid, *data):
|
||||||
file = BytesIO()
|
test_file = BytesIO()
|
||||||
PngImagePlugin.putchunk(*(file, cid) + data)
|
PngImagePlugin.putchunk(*(test_file, cid) + data)
|
||||||
return file.getvalue()
|
return test_file.getvalue()
|
||||||
|
|
||||||
o32 = PngImagePlugin.o32
|
o32 = PngImagePlugin.o32
|
||||||
|
|
||||||
|
@ -56,37 +56,37 @@ class TestFilePng(PillowTestCase):
|
||||||
self.assertRegexpMatches(
|
self.assertRegexpMatches(
|
||||||
Image.core.zlib_version, "\d+\.\d+\.\d+(\.\d+)?$")
|
Image.core.zlib_version, "\d+\.\d+\.\d+(\.\d+)?$")
|
||||||
|
|
||||||
file = self.tempfile("temp.png")
|
test_file = self.tempfile("temp.png")
|
||||||
|
|
||||||
hopper("RGB").save(file)
|
hopper("RGB").save(test_file)
|
||||||
|
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
im.load()
|
im.load()
|
||||||
self.assertEqual(im.mode, "RGB")
|
self.assertEqual(im.mode, "RGB")
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
self.assertEqual(im.format, "PNG")
|
self.assertEqual(im.format, "PNG")
|
||||||
|
|
||||||
hopper("1").save(file)
|
hopper("1").save(test_file)
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
hopper("L").save(file)
|
hopper("L").save(test_file)
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
hopper("P").save(file)
|
hopper("P").save(test_file)
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
hopper("RGB").save(file)
|
hopper("RGB").save(test_file)
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
hopper("I").save(file)
|
hopper("I").save(test_file)
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
def test_broken(self):
|
def test_broken(self):
|
||||||
# Check reading of totally broken files. In this case, the test
|
# Check reading of totally broken files. In this case, the test
|
||||||
# file was checked into Subversion as a text file.
|
# file was checked into Subversion as a text file.
|
||||||
|
|
||||||
file = "Tests/images/broken.png"
|
test_file = "Tests/images/broken.png"
|
||||||
self.assertRaises(IOError, lambda: Image.open(file))
|
self.assertRaises(IOError, lambda: Image.open(test_file))
|
||||||
|
|
||||||
def test_bad_text(self):
|
def test_bad_text(self):
|
||||||
# Make sure PIL can read malformed tEXt chunks (@PIL152)
|
# Make sure PIL can read malformed tEXt chunks (@PIL152)
|
||||||
|
@ -167,16 +167,16 @@ class TestFilePng(PillowTestCase):
|
||||||
|
|
||||||
def test_interlace(self):
|
def test_interlace(self):
|
||||||
|
|
||||||
file = "Tests/images/pil123p.png"
|
test_file = "Tests/images/pil123p.png"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
self.assert_image(im, "P", (162, 150))
|
self.assert_image(im, "P", (162, 150))
|
||||||
self.assertTrue(im.info.get("interlace"))
|
self.assertTrue(im.info.get("interlace"))
|
||||||
|
|
||||||
im.load()
|
im.load()
|
||||||
|
|
||||||
file = "Tests/images/pil123rgba.png"
|
test_file = "Tests/images/pil123rgba.png"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
self.assert_image(im, "RGBA", (162, 150))
|
self.assert_image(im, "RGBA", (162, 150))
|
||||||
self.assertTrue(im.info.get("interlace"))
|
self.assertTrue(im.info.get("interlace"))
|
||||||
|
@ -184,8 +184,8 @@ class TestFilePng(PillowTestCase):
|
||||||
im.load()
|
im.load()
|
||||||
|
|
||||||
def test_load_transparent_p(self):
|
def test_load_transparent_p(self):
|
||||||
file = "Tests/images/pil123p.png"
|
test_file = "Tests/images/pil123p.png"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
self.assert_image(im, "P", (162, 150))
|
self.assert_image(im, "P", (162, 150))
|
||||||
im = im.convert("RGBA")
|
im = im.convert("RGBA")
|
||||||
|
@ -195,8 +195,8 @@ class TestFilePng(PillowTestCase):
|
||||||
self.assertEqual(len(im.split()[3].getcolors()), 124)
|
self.assertEqual(len(im.split()[3].getcolors()), 124)
|
||||||
|
|
||||||
def test_load_transparent_rgb(self):
|
def test_load_transparent_rgb(self):
|
||||||
file = "Tests/images/rgb_trns.png"
|
test_file = "Tests/images/rgb_trns.png"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
|
|
||||||
self.assert_image(im, "RGB", (64, 64))
|
self.assert_image(im, "RGB", (64, 64))
|
||||||
im = im.convert("RGBA")
|
im = im.convert("RGBA")
|
||||||
|
@ -209,22 +209,22 @@ class TestFilePng(PillowTestCase):
|
||||||
in_file = "Tests/images/pil123p.png"
|
in_file = "Tests/images/pil123p.png"
|
||||||
im = Image.open(in_file)
|
im = Image.open(in_file)
|
||||||
|
|
||||||
file = self.tempfile("temp.png")
|
test_file = self.tempfile("temp.png")
|
||||||
im.save(file)
|
im.save(test_file)
|
||||||
|
|
||||||
def test_save_p_single_transparency(self):
|
def test_save_p_single_transparency(self):
|
||||||
in_file = "Tests/images/p_trns_single.png"
|
in_file = "Tests/images/p_trns_single.png"
|
||||||
im = Image.open(in_file)
|
im = Image.open(in_file)
|
||||||
|
|
||||||
file = self.tempfile("temp.png")
|
test_file = self.tempfile("temp.png")
|
||||||
im.save(file)
|
im.save(test_file)
|
||||||
|
|
||||||
def test_save_l_transparency(self):
|
def test_save_l_transparency(self):
|
||||||
in_file = "Tests/images/l_trns.png"
|
in_file = "Tests/images/l_trns.png"
|
||||||
im = Image.open(in_file)
|
im = Image.open(in_file)
|
||||||
|
|
||||||
file = self.tempfile("temp.png")
|
test_file = self.tempfile("temp.png")
|
||||||
im.save(file)
|
im.save(test_file)
|
||||||
|
|
||||||
# There are 559 transparent pixels.
|
# There are 559 transparent pixels.
|
||||||
im = im.convert('RGBA')
|
im = im.convert('RGBA')
|
||||||
|
@ -234,8 +234,8 @@ class TestFilePng(PillowTestCase):
|
||||||
in_file = "Tests/images/caption_6_33_22.png"
|
in_file = "Tests/images/caption_6_33_22.png"
|
||||||
im = Image.open(in_file)
|
im = Image.open(in_file)
|
||||||
|
|
||||||
file = self.tempfile("temp.png")
|
test_file = self.tempfile("temp.png")
|
||||||
im.save(file)
|
im.save(test_file)
|
||||||
|
|
||||||
def test_load_verify(self):
|
def test_load_verify(self):
|
||||||
# Check open/load/verify exception (@PIL150)
|
# Check open/load/verify exception (@PIL150)
|
||||||
|
@ -329,8 +329,8 @@ class TestFilePng(PillowTestCase):
|
||||||
# Check writing and reading of tRNS chunks for RGB images.
|
# Check writing and reading of tRNS chunks for RGB images.
|
||||||
# Independent file sample provided by Sebastian Spaeth.
|
# Independent file sample provided by Sebastian Spaeth.
|
||||||
|
|
||||||
file = "Tests/images/caption_6_33_22.png"
|
test_file = "Tests/images/caption_6_33_22.png"
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
self.assertEqual(im.info["transparency"], (248, 248, 248))
|
self.assertEqual(im.info["transparency"], (248, 248, 248))
|
||||||
|
|
||||||
# check saving transparency by default
|
# check saving transparency by default
|
||||||
|
|
|
@ -3,14 +3,14 @@ from helper import unittest, PillowTestCase
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
# sample ppm stream
|
# sample ppm stream
|
||||||
file = "Tests/images/hopper.ppm"
|
test_file = "Tests/images/hopper.ppm"
|
||||||
data = open(file, "rb").read()
|
data = open(test_file, "rb").read()
|
||||||
|
|
||||||
|
|
||||||
class TestFilePpm(PillowTestCase):
|
class TestFilePpm(PillowTestCase):
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
im.load()
|
im.load()
|
||||||
self.assertEqual(im.mode, "RGB")
|
self.assertEqual(im.mode, "RGB")
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
|
|
|
@ -3,14 +3,14 @@ from helper import unittest, PillowTestCase
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
# sample ppm stream
|
# sample ppm stream
|
||||||
file = "Tests/images/hopper.psd"
|
test_file = "Tests/images/hopper.psd"
|
||||||
data = open(file, "rb").read()
|
data = open(test_file, "rb").read()
|
||||||
|
|
||||||
|
|
||||||
class TestImagePsd(PillowTestCase):
|
class TestImagePsd(PillowTestCase):
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
im.load()
|
im.load()
|
||||||
self.assertEqual(im.mode, "RGB")
|
self.assertEqual(im.mode, "RGB")
|
||||||
self.assertEqual(im.size, (128, 128))
|
self.assertEqual(im.size, (128, 128))
|
||||||
|
|
|
@ -41,12 +41,12 @@ class TestFileWebpMetadata(PillowTestCase):
|
||||||
image = Image.open(file_path)
|
image = Image.open(file_path)
|
||||||
expected_exif = image.info['exif']
|
expected_exif = image.info['exif']
|
||||||
|
|
||||||
buffer = BytesIO()
|
test_buffer = BytesIO()
|
||||||
|
|
||||||
image.save(buffer, "webp", exif=expected_exif)
|
image.save(test_buffer, "webp", exif=expected_exif)
|
||||||
|
|
||||||
buffer.seek(0)
|
test_buffer.seek(0)
|
||||||
webp_image = Image.open(buffer)
|
webp_image = Image.open(test_buffer)
|
||||||
|
|
||||||
webp_exif = webp_image.info.get('exif', None)
|
webp_exif = webp_image.info.get('exif', None)
|
||||||
self.assertTrue(webp_exif)
|
self.assertTrue(webp_exif)
|
||||||
|
@ -76,12 +76,12 @@ class TestFileWebpMetadata(PillowTestCase):
|
||||||
image = Image.open(file_path)
|
image = Image.open(file_path)
|
||||||
expected_icc_profile = image.info['icc_profile']
|
expected_icc_profile = image.info['icc_profile']
|
||||||
|
|
||||||
buffer = BytesIO()
|
test_buffer = BytesIO()
|
||||||
|
|
||||||
image.save(buffer, "webp", icc_profile=expected_icc_profile)
|
image.save(test_buffer, "webp", icc_profile=expected_icc_profile)
|
||||||
|
|
||||||
buffer.seek(0)
|
test_buffer.seek(0)
|
||||||
webp_image = Image.open(buffer)
|
webp_image = Image.open(test_buffer)
|
||||||
|
|
||||||
webp_icc_profile = webp_image.info.get('icc_profile', None)
|
webp_icc_profile = webp_image.info.get('icc_profile', None)
|
||||||
|
|
||||||
|
@ -98,12 +98,12 @@ class TestFileWebpMetadata(PillowTestCase):
|
||||||
image = Image.open(file_path)
|
image = Image.open(file_path)
|
||||||
self.assertTrue('exif' in image.info)
|
self.assertTrue('exif' in image.info)
|
||||||
|
|
||||||
buffer = BytesIO()
|
test_buffer = BytesIO()
|
||||||
|
|
||||||
image.save(buffer, "webp")
|
image.save(test_buffer, "webp")
|
||||||
|
|
||||||
buffer.seek(0)
|
test_buffer.seek(0)
|
||||||
webp_image = Image.open(buffer)
|
webp_image = Image.open(test_buffer)
|
||||||
|
|
||||||
self.assertFalse(webp_image._getexif())
|
self.assertFalse(webp_image._getexif())
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ class TestFontBdf(PillowTestCase):
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
|
|
||||||
file = open(filename, "rb")
|
test_file = open(filename, "rb")
|
||||||
font = BdfFontFile.BdfFontFile(file)
|
font = BdfFontFile.BdfFontFile(test_file)
|
||||||
|
|
||||||
self.assertIsInstance(font, FontFile.FontFile)
|
self.assertIsInstance(font, FontFile.FontFile)
|
||||||
self.assertEqual(len([_f for _f in font.glyph if _f]), 190)
|
self.assertEqual(len([_f for _f in font.glyph if _f]), 190)
|
||||||
|
|
|
@ -17,8 +17,8 @@ class TestFontPcf(PillowTestCase):
|
||||||
self.skipTest("zlib support not available")
|
self.skipTest("zlib support not available")
|
||||||
|
|
||||||
def save_font(self):
|
def save_font(self):
|
||||||
file = open(fontname, "rb")
|
test_file = open(fontname, "rb")
|
||||||
font = PcfFontFile.PcfFontFile(file)
|
font = PcfFontFile.PcfFontFile(test_file)
|
||||||
self.assertIsInstance(font, FontFile.FontFile)
|
self.assertIsInstance(font, FontFile.FontFile)
|
||||||
self.assertEqual(len([_f for _f in font.glyph if _f]), 192)
|
self.assertEqual(len([_f for _f in font.glyph if _f]), 192)
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ class TestImage(PillowTestCase):
|
||||||
im.paste(0, (0, 0, 100, 100))
|
im.paste(0, (0, 0, 100, 100))
|
||||||
self.assertFalse(im.readonly)
|
self.assertFalse(im.readonly)
|
||||||
|
|
||||||
file = self.tempfile("temp.ppm")
|
test_file = self.tempfile("temp.ppm")
|
||||||
im._dump(file)
|
im._dump(test_file)
|
||||||
|
|
||||||
def test_comparison_with_other_type(self):
|
def test_comparison_with_other_type(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -76,10 +76,10 @@ class TestImageFilter(PillowTestCase):
|
||||||
# 0 1 2
|
# 0 1 2
|
||||||
# 3 4 5
|
# 3 4 5
|
||||||
# 6 7 8
|
# 6 7 8
|
||||||
min = im.filter(ImageFilter.MinFilter).getpixel((1, 1))
|
minimum = im.filter(ImageFilter.MinFilter).getpixel((1, 1))
|
||||||
med = im.filter(ImageFilter.MedianFilter).getpixel((1, 1))
|
med = im.filter(ImageFilter.MedianFilter).getpixel((1, 1))
|
||||||
max = im.filter(ImageFilter.MaxFilter).getpixel((1, 1))
|
maximum = im.filter(ImageFilter.MaxFilter).getpixel((1, 1))
|
||||||
return min, med, max
|
return minimum, med, maximum
|
||||||
|
|
||||||
self.assertEqual(rankfilter("1"), (0, 4, 8))
|
self.assertEqual(rankfilter("1"), (0, 4, 8))
|
||||||
self.assertEqual(rankfilter("L"), (0, 4, 8))
|
self.assertEqual(rankfilter("L"), (0, 4, 8))
|
||||||
|
|
|
@ -45,13 +45,13 @@ class TestImageSplit(PillowTestCase):
|
||||||
codecs = dir(Image.core)
|
codecs = dir(Image.core)
|
||||||
|
|
||||||
if 'zip_encoder' in codecs:
|
if 'zip_encoder' in codecs:
|
||||||
file = self.tempfile("temp.png")
|
test_file = self.tempfile("temp.png")
|
||||||
else:
|
else:
|
||||||
file = self.tempfile("temp.pcx")
|
test_file = self.tempfile("temp.pcx")
|
||||||
|
|
||||||
def split_open(mode):
|
def split_open(mode):
|
||||||
hopper(mode).save(file)
|
hopper(mode).save(test_file)
|
||||||
im = Image.open(file)
|
im = Image.open(test_file)
|
||||||
return len(im.split())
|
return len(im.split())
|
||||||
self.assertEqual(split_open("1"), 1)
|
self.assertEqual(split_open("1"), 1)
|
||||||
self.assertEqual(split_open("L"), 1)
|
self.assertEqual(split_open("L"), 1)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from helper import unittest, PillowTestCase, hopper
|
import helper
|
||||||
|
from helper import unittest, PillowTestCase
|
||||||
|
|
||||||
from PIL.Image import (FLIP_LEFT_RIGHT, FLIP_TOP_BOTTOM, ROTATE_90, ROTATE_180,
|
from PIL.Image import (FLIP_LEFT_RIGHT, FLIP_TOP_BOTTOM, ROTATE_90, ROTATE_180,
|
||||||
ROTATE_270, TRANSPOSE)
|
ROTATE_270, TRANSPOSE)
|
||||||
|
@ -7,8 +8,8 @@ from PIL.Image import (FLIP_LEFT_RIGHT, FLIP_TOP_BOTTOM, ROTATE_90, ROTATE_180,
|
||||||
class TestImageTranspose(PillowTestCase):
|
class TestImageTranspose(PillowTestCase):
|
||||||
|
|
||||||
hopper = {
|
hopper = {
|
||||||
'L': hopper('L').crop((0, 0, 121, 127)).copy(),
|
'L': helper.hopper('L').crop((0, 0, 121, 127)).copy(),
|
||||||
'RGB': hopper('RGB').crop((0, 0, 121, 127)).copy(),
|
'RGB': helper.hopper('RGB').crop((0, 0, 121, 127)).copy(),
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_flip_left_right(self):
|
def test_flip_left_right(self):
|
||||||
|
|
|
@ -24,11 +24,11 @@ class TestImageFile(PillowTestCase):
|
||||||
if format in ("MSP", "XBM"):
|
if format in ("MSP", "XBM"):
|
||||||
im = im.convert("1")
|
im = im.convert("1")
|
||||||
|
|
||||||
file = BytesIO()
|
test_file = BytesIO()
|
||||||
|
|
||||||
im.save(file, format)
|
im.save(test_file, format)
|
||||||
|
|
||||||
data = file.getvalue()
|
data = test_file.getvalue()
|
||||||
|
|
||||||
parser = ImageFile.Parser()
|
parser = ImageFile.Parser()
|
||||||
parser.feed(data)
|
parser.feed(data)
|
||||||
|
|
|
@ -94,7 +94,8 @@ try:
|
||||||
def _render(self, font):
|
def _render(self, font):
|
||||||
txt = "Hello World!"
|
txt = "Hello World!"
|
||||||
ttf = ImageFont.truetype(font, FONT_SIZE)
|
ttf = ImageFont.truetype(font, FONT_SIZE)
|
||||||
w, h = ttf.getsize(txt)
|
ttf.getsize(txt)
|
||||||
|
|
||||||
img = Image.new("RGB", (256, 64), "white")
|
img = Image.new("RGB", (256, 64), "white")
|
||||||
d = ImageDraw.Draw(img)
|
d = ImageDraw.Draw(img)
|
||||||
d.text((10, 10), txt, font=ttf, fill='black')
|
d.text((10, 10), txt, font=ttf, fill='black')
|
||||||
|
|
|
@ -17,11 +17,11 @@ class TestImagePalette(PillowTestCase):
|
||||||
|
|
||||||
palette = ImagePalette()
|
palette = ImagePalette()
|
||||||
|
|
||||||
map = {}
|
test_map = {}
|
||||||
for i in range(256):
|
for i in range(256):
|
||||||
map[palette.getcolor((i, i, i))] = i
|
test_map[palette.getcolor((i, i, i))] = i
|
||||||
|
|
||||||
self.assertEqual(len(map), 256)
|
self.assertEqual(len(test_map), 256)
|
||||||
self.assertRaises(ValueError, lambda: palette.getcolor((1, 2, 3)))
|
self.assertRaises(ValueError, lambda: palette.getcolor((1, 2, 3)))
|
||||||
|
|
||||||
def test_file(self):
|
def test_file(self):
|
||||||
|
|
|
@ -7,10 +7,10 @@ class TestImageSequence(PillowTestCase):
|
||||||
|
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
|
|
||||||
file = self.tempfile("temp.im")
|
test_file = self.tempfile("temp.im")
|
||||||
|
|
||||||
im = hopper("RGB")
|
im = hopper("RGB")
|
||||||
im.save(file)
|
im.save(test_file)
|
||||||
|
|
||||||
seq = ImageSequence.Iterator(im)
|
seq = ImageSequence.Iterator(im)
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,8 @@ class TestImageWinDib(PillowTestCase):
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
# Make one the same as the using tobytes()/frombytes()
|
# Make one the same as the using tobytes()/frombytes()
|
||||||
buffer = dib1.tobytes()
|
test_buffer = dib1.tobytes()
|
||||||
dib2.frombytes(buffer)
|
dib2.frombytes(test_buffer)
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
# Confirm they're the same
|
# Confirm they're the same
|
||||||
|
@ -111,11 +111,11 @@ class TestImageWinDib(PillowTestCase):
|
||||||
# Arrange
|
# Arrange
|
||||||
im = hopper()
|
im = hopper()
|
||||||
dib = ImageWin.Dib(im)
|
dib = ImageWin.Dib(im)
|
||||||
buffer = dib.tobytes()
|
test_buffer = dib.tobytes()
|
||||||
|
|
||||||
# Act/Assert
|
# Act/Assert
|
||||||
self.assert_warning(DeprecationWarning, dib.tostring)
|
self.assert_warning(DeprecationWarning, dib.tostring)
|
||||||
self.assert_warning(DeprecationWarning, lambda: dib.fromstring(buffer))
|
self.assert_warning(DeprecationWarning, lambda: dib.fromstring(test_buffer))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -64,15 +64,15 @@ class TestModeI16(PillowTestCase):
|
||||||
self.assertEqual(imIn.getpixel((0, 0)), 2)
|
self.assertEqual(imIn.getpixel((0, 0)), 2)
|
||||||
|
|
||||||
if mode == "L":
|
if mode == "L":
|
||||||
max = 255
|
maximum = 255
|
||||||
else:
|
else:
|
||||||
max = 32767
|
maximum = 32767
|
||||||
|
|
||||||
imIn = Image.new(mode, (1, 1), 256)
|
imIn = Image.new(mode, (1, 1), 256)
|
||||||
self.assertEqual(imIn.getpixel((0, 0)), min(256, max))
|
self.assertEqual(imIn.getpixel((0, 0)), min(256, maximum))
|
||||||
|
|
||||||
imIn.putpixel((0, 0), 512)
|
imIn.putpixel((0, 0), 512)
|
||||||
self.assertEqual(imIn.getpixel((0, 0)), min(512, max))
|
self.assertEqual(imIn.getpixel((0, 0)), min(512, maximum))
|
||||||
|
|
||||||
basic("L")
|
basic("L")
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class TestPickle(PillowTestCase):
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
# Act / Assert
|
# Act / Assert
|
||||||
for file in [
|
for test_file in [
|
||||||
"Tests/images/test-card.png",
|
"Tests/images/test-card.png",
|
||||||
"Tests/images/zero_bb.png",
|
"Tests/images/zero_bb.png",
|
||||||
"Tests/images/zero_bb_scale2.png",
|
"Tests/images/zero_bb_scale2.png",
|
||||||
|
@ -69,7 +69,7 @@ class TestPickle(PillowTestCase):
|
||||||
"Tests/images/p_trns_single.png",
|
"Tests/images/p_trns_single.png",
|
||||||
"Tests/images/pil123p.png"
|
"Tests/images/pil123p.png"
|
||||||
]:
|
]:
|
||||||
self.helper_pickle_string(pickle, file=file)
|
self.helper_pickle_string(pickle, file=test_file)
|
||||||
|
|
||||||
def test_pickle_l_mode(self):
|
def test_pickle_l_mode(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
|
|
@ -6,10 +6,7 @@ import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
try:
|
test_format = sys.argv[1] if len(sys.argv) > 1 else "PNG"
|
||||||
format = sys.argv[1]
|
|
||||||
except:
|
|
||||||
format = "PNG"
|
|
||||||
|
|
||||||
im = Image.open("Tests/images/hopper.ppm")
|
im = Image.open("Tests/images/hopper.ppm")
|
||||||
im.load()
|
im.load()
|
||||||
|
@ -28,7 +25,7 @@ class Worker(threading.Thread):
|
||||||
sys.stdout.write("x")
|
sys.stdout.write("x")
|
||||||
break
|
break
|
||||||
f = io.BytesIO()
|
f = io.BytesIO()
|
||||||
im.save(f, format, optimize=1)
|
im.save(f, test_format, optimize=1)
|
||||||
data = f.getvalue()
|
data = f.getvalue()
|
||||||
result.append(len(data))
|
result.append(len(data))
|
||||||
im = Image.open(io.BytesIO(data))
|
im = Image.open(io.BytesIO(data))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user