def testDraw(self): w, h, path = 68, 72, 'polygon 14,12 64,0 68,72 0,54' l = [] for i in range(10): im = Image.create(w, h, Color.named("blue")) im.draw(path) l.append(im)
def testGetPixels(self): im = Image.create(100, 100, Color.named('white')) with im.getPixels(50, 50, 50, 50) as px: p0 = px[0, 0] self.assertEqual((p0.red, p0.green, p0.blue), (65535, 65535, 65535)) p0 = px[49, 49] self.assertEqual((p0.red, p0.green, p0.blue), (65535, 65535, 65535))
def testImage(self): for i in range(1*self.mult): self.show('Image', i) im = [] for j in range(10): im.append(Image.create(1024, 1024, Color.named("white"))) if self.verbose > 1: import os with open('/proc/{0}/status'.format(os.getpid()), 'rt') as f: for line in f: if 'VmData' in line: print(line.strip())
def testImage(self): for i in range(1 * self.mult): self.show('Image', i) im = [] for j in range(10): im.append(Image.create(1024, 1024, Color.named("white"))) if self.verbose > 1: import os with open('/proc/{0}/status'.format(os.getpid()), 'rt') as f: for line in f: if 'VmData' in line: print(line.strip())
def testTile(self): im = Image.tile(self.samplepath2, 200, 200) self.assertEqual(im.width, 200) self.assertEqual(im.height, 200)
def testNewImage(self): im = Image.create(100, 100, Color.named("blue")) self.assertTrue(im) return im
def testWriteError(self): im = Image.read(self.samplepath) self.assertRaises(ImageMagickException, im.write, '/tmp/not_existent_directory/my.jpg')
def testWrite(self): im = Image.read(self.samplepath) self.assertTrue(im.write(self.outputpath))
def testPing(self): im = Image.ping(self.samplepath) self.assertTrue(im) self.assertEqual(615, im.width) self.assertEqual(410, im.height) return im
def testPDFConversionToImage(self): """ This tests a use case of converting a PDF to a thumbnail of the first page """ im = Image.read(self.pdfpath) self.assertTrue(im.write(self.outputpath))
def testCreate(self): self.assertTrue(Image())
def testRead2(self): res = Image.read(self.samplepath2) self.assertTrue(res) return res