mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	add Overlay chop
This commit is contained in:
		
							parent
							
								
									705140cc2c
								
							
						
					
					
						commit
						23c9da5264
					
				| 
						 | 
				
			
			@ -392,6 +392,19 @@ def test_hardlight(self):
 | 
			
		|||
    self.assertEqual(new.getpixel((15, 100)), (1, 1, 2))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_overlay(self):
 | 
			
		||||
    # Arrange
 | 
			
		||||
    im1 = Image.open("Tests/images/hopper.png")
 | 
			
		||||
    im2 = Image.open("Tests/images/hopper-XYZ.png")
 | 
			
		||||
 | 
			
		||||
    # Act
 | 
			
		||||
    new = ImageChops.overlay(im1, im2)
 | 
			
		||||
 | 
			
		||||
    # Assert
 | 
			
		||||
    self.assertEqual(new.getpixel((64, 64)), (159, 50, 27))
 | 
			
		||||
    self.assertEqual(new.getpixel((15, 100)), (1, 1, 2))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_logical():
 | 
			
		||||
    def table(op, a, b):
 | 
			
		||||
        out = []
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -138,6 +138,7 @@ def screen(image1, image2):
 | 
			
		|||
    image2.load()
 | 
			
		||||
    return image1._new(image1.im.chop_screen(image2.im))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def softlight(image1, image2):
 | 
			
		||||
    """
 | 
			
		||||
    Superimposes two images on top of each other using the Soft Light algorithm
 | 
			
		||||
| 
						 | 
				
			
			@ -149,6 +150,7 @@ def softlight(image1, image2):
 | 
			
		|||
    image2.load()
 | 
			
		||||
    return image1._new(image1.im.chop_softlight(image2.im))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def hardlight(image1, image2):
 | 
			
		||||
    """
 | 
			
		||||
    Superimposes two images on top of each other using the Hard Light algorithm
 | 
			
		||||
| 
						 | 
				
			
			@ -160,6 +162,7 @@ def hardlight(image1, image2):
 | 
			
		|||
    image2.load()
 | 
			
		||||
    return image1._new(image1.im.chop_hardlight(image2.im))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def softlight(image1, image2):
 | 
			
		||||
    """
 | 
			
		||||
    Superimposes two images on top of each other using the Soft Light algorithm
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user