def check_placement(self, x, y): font = ImageFont.load_default() td = TextDraw('Hello\nWorld\n%s %s' % (x, y), font, placement=x+y, padding=5, linespacing=2) img = Image.new('RGB', (100, 100)) draw = ImageDraw.Draw(img) td.draw(draw, img.size) img.show()
def test_transparent(self): font = ImageFont.load_default() td = TextDraw('Hello\nWorld', font, placement='cc') img = Image.new('RGBA', (100, 100), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) td.draw(draw, img.size) eq_(len(img.getcolors()), 2) # top color (bg) is transparent eq_(sorted(img.getcolors())[1][1], (0, 0, 0, 0))
def check_placement(self, x, y): font = ImageFont.load_default() td = TextDraw('Hello\nWorld\n%s %s' % (x, y), font, placement=x + y, padding=5, linespacing=2) img = Image.new('RGB', (100, 100)) draw = ImageDraw.Draw(img) td.draw(draw, img.size) img.show()