mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	extents test
This commit is contained in:
		
							parent
							
								
									5e897341c6
								
							
						
					
					
						commit
						2241f744d9
					
				| 
						 | 
					@ -2,6 +2,19 @@ from tester import *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PIL import Image
 | 
					from PIL import Image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_extent():
 | 
				
			||||||
 | 
					    im = lena('RGB')
 | 
				
			||||||
 | 
					    (w,h) = im.size
 | 
				
			||||||
 | 
					    transformed = im.transform(im.size, Image.EXTENT,
 | 
				
			||||||
 | 
					                               (0,0,
 | 
				
			||||||
 | 
					                                w/2,h/2), # ul -> lr
 | 
				
			||||||
 | 
					                               Image.BILINEAR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    scaled = im.resize((w*2, h*2), Image.BILINEAR).crop((0,0,w,h))
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    assert_image_similar(transformed, scaled, 10) # undone -- precision?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_quad():
 | 
					def test_quad():
 | 
				
			||||||
    # one simple quad transform, equivalent to scale & crop upper left quad
 | 
					    # one simple quad transform, equivalent to scale & crop upper left quad
 | 
				
			||||||
    im = lena('RGB')
 | 
					    im = lena('RGB')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user