def test_fontpointsize(self): img = Image((300, 200), 'red') img.font_pointsize(60) self.assertEqual(60, img.font_pointsize()) self.assertEqual(float, type(img.font_pointsize())) img.annotate("hello", (100, 100)) img.write('t.png')
def test_fontpointsize(self): img = Image((300, 200), 'red') img.font_pointsize(60) self.assertEqual(60, img.font_pointsize()) self.assertEqual(float, type(img.font_pointsize())) if sys.platform.lower() == 'darwin': img.font("/Library/Fonts/Arial.ttf") img.annotate("hello", (100, 100)) img.write('t.png')
def test_scale_with_filtertype(self): testset = {"Catrom": None, "Cubic": None, "None": None} for k, v in testset.items(): img = Image((600, 400), 'gradient:#ffffff-#000000') if sys.platform.lower() == 'darwin': img.font("/Library/Fonts/Arial.ttf") img.annotate("hello", (100, 100)) if k != "None": img.scale(0.6, k) else: img.scale(0.6) img.write('t.jpg') m = hashlib.md5() with open('t.jpg', 'rb') as fp: m.update(fp.read()) testset[k] = m.hexdigest() self.assertNotEqual(testset["Catrom"], testset["None"]) self.assertNotEqual(testset["Cubic"], testset["None"]) self.assertNotEqual(testset["Catrom"], testset["Cubic"])
# coding: utf-8 from pgmagick.api import Image img = Image((300, 200)) img.font("/etc/alternatives/fonts-japanese-gothic.ttf") img.annotate('Hello World') img.annotate('ようこそpgmagickへ!!') img.write('japanese-text.png')