Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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))
Пример #4
0
 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))
Пример #5
0
 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())
Пример #6
0
 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())
Пример #7
0
 def testTile(self):
     im = Image.tile(self.samplepath2, 200, 200)
     self.assertEqual(im.width, 200)
     self.assertEqual(im.height, 200)
Пример #8
0
 def testNewImage(self):
     im = Image.create(100, 100, Color.named("blue"))
     self.assertTrue(im)
     return im
Пример #9
0
 def testWriteError(self):
     im = Image.read(self.samplepath)
     self.assertRaises(ImageMagickException, im.write,
                       '/tmp/not_existent_directory/my.jpg')
Пример #10
0
 def testWrite(self):
     im = Image.read(self.samplepath)
     self.assertTrue(im.write(self.outputpath))
Пример #11
0
 def testWrite(self):
     im = Image.read(self.samplepath)
     self.assertTrue(im.write(self.outputpath))
Пример #12
0
 def testPing(self):
     im = Image.ping(self.samplepath)
     self.assertTrue(im)
     self.assertEqual(615, im.width)
     self.assertEqual(410, im.height)
     return im
Пример #13
0
 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))
Пример #14
0
 def testTile(self):
     im = Image.tile(self.samplepath2, 200, 200)
     self.assertEqual(im.width, 200)
     self.assertEqual(im.height, 200)
Пример #15
0
 def testNewImage(self):
     im = Image.create(100, 100, Color.named("blue"))
     self.assertTrue(im)
     return im
Пример #16
0
 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))
Пример #17
0
 def testCreate(self):
     self.assertTrue(Image())
Пример #18
0
 def testRead2(self):
     res = Image.read(self.samplepath2)
     self.assertTrue(res)
     return res
Пример #19
0
 def testPing(self):
     im = Image.ping(self.samplepath)
     self.assertTrue(im)
     self.assertEqual(615, im.width)
     self.assertEqual(410, im.height)
     return im
Пример #20
0
 def testWriteError(self):
     im = Image.read(self.samplepath)
     self.assertRaises(ImageMagickException, im.write, '/tmp/not_existent_directory/my.jpg')
Пример #21
0
 def testRead2(self):
     res = Image.read(self.samplepath2)
     self.assertTrue(res)
     return res