Beispiel #1
0
    def test_sanity(self):

        im = hopper("L")

        ImageChops.constant(im, 128)
        ImageChops.duplicate(im)
        ImageChops.invert(im)
        ImageChops.lighter(im, im)
        ImageChops.darker(im, im)
        ImageChops.difference(im, im)
        ImageChops.multiply(im, im)
        ImageChops.screen(im, im)

        ImageChops.add(im, im)
        ImageChops.add(im, im, 2.0)
        ImageChops.add(im, im, 2.0, 128)
        ImageChops.subtract(im, im)
        ImageChops.subtract(im, im, 2.0)
        ImageChops.subtract(im, im, 2.0, 128)

        ImageChops.add_modulo(im, im)
        ImageChops.subtract_modulo(im, im)

        ImageChops.blend(im, im, 0.5)
        ImageChops.composite(im, im, im)

        ImageChops.offset(im, 10)
        ImageChops.offset(im, 10, 20)
Beispiel #2
0
    def test_difference_pixel(self):
        # Arrange
        im1 = hopper()
        im2 = Image.open("Tests/images/imagedraw_polygon_kite_RGB.png")

        # Act
        new = ImageChops.difference(im1, im2)

        # Assert
        self.assertEqual(new.getpixel((50, 50)), (240, 166, 128))
Beispiel #3
0
    def test_difference(self):
        # Arrange
        im1 = Image.open("Tests/images/imagedraw_arc_end_le_start.png")
        im2 = Image.open("Tests/images/imagedraw_arc_no_loops.png")

        # Act
        new = ImageChops.difference(im1, im2)

        # Assert
        self.assertEqual(new.getbbox(), (25, 25, 76, 76))