mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Round crop args to nearest integers (#1744)
This commit is contained in:
		
							parent
							
								
									39e407dbc1
								
							
						
					
					
						commit
						239f09435a
					
				| 
						 | 
					@ -1941,7 +1941,9 @@ class _ImageCrop(Image):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Image.__init__(self)
 | 
					        Image.__init__(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        x0, y0, x1, y1 = box
 | 
					        # Round to nearest integer, runs int(round(x)) when unpacking
 | 
				
			||||||
 | 
					        x0, y0, x1, y1 = map(int, map(round, box))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if x1 < x0:
 | 
					        if x1 < x0:
 | 
				
			||||||
            x1 = x0
 | 
					            x1 = x0
 | 
				
			||||||
        if y1 < y0:
 | 
					        if y1 < y0:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user