mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 16:07:30 +03:00 
			
		
		
		
	This fixes a bug with rounding pixels to the nearest palette color. Specifically, there is a typo with computing the minimum distance from a palette color to a given cache box. This is causing palette colors to be incorrectly excluded from consideration.
		
			
				
	
	
		
			18 lines
		
	
	
		
			561 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			561 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from .helper import hopper
 | |
| 
 | |
| 
 | |
| def test_histogram():
 | |
|     def histogram(mode):
 | |
|         h = hopper(mode).histogram()
 | |
|         return len(h), min(h), max(h)
 | |
| 
 | |
|     assert histogram("1") == (256, 0, 10994)
 | |
|     assert histogram("L") == (256, 0, 662)
 | |
|     assert histogram("I") == (256, 0, 662)
 | |
|     assert histogram("F") == (256, 0, 662)
 | |
|     assert histogram("P") == (256, 0, 1551)
 | |
|     assert histogram("RGB") == (768, 4, 675)
 | |
|     assert histogram("RGBA") == (1024, 0, 16384)
 | |
|     assert histogram("CMYK") == (1024, 0, 16384)
 | |
|     assert histogram("YCbCr") == (768, 0, 1908)
 |