mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-20 21:41:02 +03:00
commit
6378465521
|
@ -76,7 +76,7 @@ class TestFileEps(PillowTestCase):
|
||||||
plot_image = Image.open("Tests/images/reqd_showpage.eps")
|
plot_image = Image.open("Tests/images/reqd_showpage.eps")
|
||||||
target = Image.open("Tests/images/reqd_showpage.png")
|
target = Image.open("Tests/images/reqd_showpage.png")
|
||||||
|
|
||||||
#should not crash/hang
|
# should not crash/hang
|
||||||
plot_image.load()
|
plot_image.load()
|
||||||
# fonts could be slightly different
|
# fonts could be slightly different
|
||||||
self.assert_image_similar(plot_image, target, 6)
|
self.assert_image_similar(plot_image, target, 6)
|
||||||
|
|
|
@ -20,7 +20,7 @@ class TestFontPcf(PillowTestCase):
|
||||||
with open(fontname, "rb") as test_file:
|
with open(fontname, "rb") as test_file:
|
||||||
font = PcfFontFile.PcfFontFile(test_file)
|
font = PcfFontFile.PcfFontFile(test_file)
|
||||||
self.assertIsInstance(font, FontFile.FontFile)
|
self.assertIsInstance(font, FontFile.FontFile)
|
||||||
#check the number of characters in the font
|
# check the number of characters in the font
|
||||||
self.assertEqual(len([_f for _f in font.glyph if _f]), 223)
|
self.assertEqual(len([_f for _f in font.glyph if _f]), 223)
|
||||||
|
|
||||||
tempname = self.tempfile("temp.pil")
|
tempname = self.tempfile("temp.pil")
|
||||||
|
@ -66,7 +66,7 @@ class TestFontPcf(PillowTestCase):
|
||||||
def _test_high_characters(self, message):
|
def _test_high_characters(self, message):
|
||||||
tempname = self.save_font()
|
tempname = self.save_font()
|
||||||
font = ImageFont.load(tempname)
|
font = ImageFont.load(tempname)
|
||||||
im = Image.new("L", (750, 30) , "white")
|
im = Image.new("L", (750, 30), "white")
|
||||||
draw = ImageDraw.Draw(im)
|
draw = ImageDraw.Draw(im)
|
||||||
draw.text((0, 0), message, "black", font=font)
|
draw.text((0, 0), message, "black", font=font)
|
||||||
with Image.open('Tests/images/high_ascii_chars.png') as target:
|
with Image.open('Tests/images/high_ascii_chars.png') as target:
|
||||||
|
|
|
@ -295,7 +295,7 @@ int main(int argc, char* argv[])
|
||||||
compiler.add_include_dir(sysconfig.get_python_inc())
|
compiler.add_include_dir(sysconfig.get_python_inc())
|
||||||
|
|
||||||
libdir = sysconfig.get_config_var('LIBDIR') or sysconfig.get_python_inc().replace('include', 'libs')
|
libdir = sysconfig.get_config_var('LIBDIR') or sysconfig.get_python_inc().replace('include', 'libs')
|
||||||
print (libdir)
|
print(libdir)
|
||||||
compiler.add_library_dir(libdir)
|
compiler.add_library_dir(libdir)
|
||||||
objects = compiler.compile(['embed_pil.c'])
|
objects = compiler.compile(['embed_pil.c'])
|
||||||
compiler.link_executable(objects, 'embed_pil')
|
compiler.link_executable(objects, 'embed_pil')
|
||||||
|
|
|
@ -59,7 +59,7 @@ class TestImageTransform(PillowTestCase):
|
||||||
(0, 0,
|
(0, 0,
|
||||||
w*2, h*2),
|
w*2, h*2),
|
||||||
Image.BILINEAR,
|
Image.BILINEAR,
|
||||||
fillcolor = 'red')
|
fillcolor='red')
|
||||||
|
|
||||||
self.assertEqual(transformed.getpixel((w-1, h-1)), (255, 0, 0))
|
self.assertEqual(transformed.getpixel((w-1, h-1)), (255, 0, 0))
|
||||||
|
|
||||||
|
|
|
@ -310,8 +310,8 @@ def _save(im, fp, filename):
|
||||||
|
|
||||||
# create the temporary set of pngs
|
# create the temporary set of pngs
|
||||||
iconset = tempfile.mkdtemp('.iconset')
|
iconset = tempfile.mkdtemp('.iconset')
|
||||||
provided_images = {im.width:im for im in
|
provided_images = {im.width: im
|
||||||
im.encoderinfo.get("append_images", [])}
|
for im in im.encoderinfo.get("append_images", [])}
|
||||||
last_w = None
|
last_w = None
|
||||||
for w in [16, 32, 128, 256, 512]:
|
for w in [16, 32, 128, 256, 512]:
|
||||||
prefix = 'icon_{}x{}'.format(w, w)
|
prefix = 'icon_{}x{}'.format(w, w)
|
||||||
|
|
|
@ -358,7 +358,7 @@ _initialized = 0
|
||||||
|
|
||||||
|
|
||||||
def preinit():
|
def preinit():
|
||||||
"Explicitly load standard file format drivers."
|
"""Explicitly load standard file format drivers."""
|
||||||
|
|
||||||
global _initialized
|
global _initialized
|
||||||
if _initialized >= 1:
|
if _initialized >= 1:
|
||||||
|
@ -2246,7 +2246,7 @@ class ImageTransformHandler(object):
|
||||||
# Debugging
|
# Debugging
|
||||||
|
|
||||||
def _wedge():
|
def _wedge():
|
||||||
"Create greyscale wedge (for debugging only)"
|
"""Create greyscale wedge (for debugging only)"""
|
||||||
|
|
||||||
return Image()._new(core.wedge("L"))
|
return Image()._new(core.wedge("L"))
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ class PdfName:
|
||||||
def from_pdf_stream(klass, data):
|
def from_pdf_stream(klass, data):
|
||||||
return klass(PdfParser.interpret_name(data))
|
return klass(PdfParser.interpret_name(data))
|
||||||
|
|
||||||
allowed_chars = set(range(33,127)) - set(ord(c) for c in "#%/()<>[]{}")
|
allowed_chars = set(range(33, 127)) - set(ord(c) for c in "#%/()<>[]{}")
|
||||||
|
|
||||||
def __bytes__(self):
|
def __bytes__(self):
|
||||||
if str == bytes: # Python 2.x
|
if str == bytes: # Python 2.x
|
||||||
|
|
|
@ -663,7 +663,7 @@ _OUTMODES = {
|
||||||
|
|
||||||
|
|
||||||
def putchunk(fp, cid, *data):
|
def putchunk(fp, cid, *data):
|
||||||
"Write a PNG chunk (including CRC field)"
|
"""Write a PNG chunk (including CRC field)"""
|
||||||
|
|
||||||
data = b"".join(data)
|
data = b"".join(data)
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ class SpiderImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
# given a list of filenames, return a list of images
|
# given a list of filenames, return a list of images
|
||||||
def loadImageSeries(filelist=None):
|
def loadImageSeries(filelist=None):
|
||||||
" create a list of Image.images for use in montage "
|
"""create a list of Image.images for use in montage"""
|
||||||
if filelist is None or len(filelist) < 1:
|
if filelist is None or len(filelist) < 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ def get_supported_features():
|
||||||
|
|
||||||
|
|
||||||
def check(feature):
|
def check(feature):
|
||||||
return (feature in modules and check_module(feature) or \
|
return (feature in modules and check_module(feature) or
|
||||||
feature in codecs and check_codec(feature) or \
|
feature in codecs and check_codec(feature) or
|
||||||
feature in features and check_feature(feature))
|
feature in features and check_feature(feature))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user