コード例 #1
0
 def test_adjust__max_width__smaller(self):
     im = Image.open(self._data_path('100x100.png'))
     fill = Fill(height=100, max_width=50)
     adjusted = fill.adjust(im)
     self.assertEqual(adjusted.size, (50, 100))
     expected = Image.open(self._data_path('50x100_crop.png'))
     self.assertImageEqual(adjusted, expected)
コード例 #2
0
 def test_adjust__unequal(self):
     im = Image.open(self._data_path('100x100.png'))
     fill = Fill(width=50, height=40)
     adjusted = fill.adjust(im)
     self.assertEqual(adjusted.size, (50, 40))
     expected = Image.open(self._data_path('50x40_fill.png'))
     self.assertImageEqual(adjusted, expected)
コード例 #3
0
 def test_adjust__max_width(self):
     im = Image.open(self._data_path('100x100.png'))
     fill = Fill(height=50, max_width=200)
     adjusted = fill.adjust(im)
     self.assertEqual(adjusted.size, (50, 50))
     expected = Image.open(self._data_path('50x50_fit.png'))
     self.assertImageEqual(adjusted, expected)
コード例 #4
0
 def test_adjust__max_width__smaller(self):
     im = Image.open(self._data_path('100x100.png'))
     fill = Fill(height=100, max_width=50)
     adjusted = fill.adjust(im)
     self.assertEqual(adjusted.size, (50, 100))
     expected = Image.open(self._data_path('50x100_crop.png'))
     self.assertImageEqual(adjusted, expected)
コード例 #5
0
 def test_adjust__unequal(self):
     im = Image.open(self._data_path('100x100.png'))
     fill = Fill(width=50, height=40)
     adjusted = fill.adjust(im)
     self.assertEqual(adjusted.size, (50, 40))
     expected = Image.open(self._data_path('50x40_fill.png'))
     self.assertImageEqual(adjusted, expected)
コード例 #6
0
 def test_adjust__max_width(self):
     im = Image.open(self._data_path('100x100.png'))
     fill = Fill(height=50, max_width=200)
     adjusted = fill.adjust(im)
     self.assertEqual(adjusted.size, (50, 50))
     expected = Image.open(self._data_path('50x50_fit.png'))
     self.assertImageEqual(adjusted, expected)