Pillow/Tests/test_image_histogram.py

21 lines
758 B
Python
Raw Normal View History

from .helper import PillowTestCase, hopper
2014-06-10 13:10:47 +04:00
class TestImageHistogram(PillowTestCase):
2014-06-10 13:10:47 +04:00
def test_histogram(self):
2014-06-10 13:10:47 +04:00
def histogram(mode):
h = hopper(mode).histogram()
2014-06-10 13:10:47 +04:00
return len(h), min(h), max(h)
self.assertEqual(histogram("1"), (256, 0, 10994))
self.assertEqual(histogram("L"), (256, 0, 638))
2019-05-08 14:58:33 +03:00
self.assertEqual(histogram("I"), (256, 1, 662))
self.assertEqual(histogram("F"), (256, 0, 638))
self.assertEqual(histogram("P"), (256, 0, 1871))
self.assertEqual(histogram("RGB"), (768, 4, 675))
2014-06-10 13:10:47 +04:00
self.assertEqual(histogram("RGBA"), (1024, 0, 16384))
self.assertEqual(histogram("CMYK"), (1024, 0, 16384))
self.assertEqual(histogram("YCbCr"), (768, 0, 1908))