mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Support 16-bit grayscale ImageQt conversion.
This commit is contained in:
		
							parent
							
								
									c43f55121c
								
							
						
					
					
						commit
						6aca23cfa3
					
				| 
						 | 
					@ -108,7 +108,7 @@ def align8to32(bytes, width, mode):
 | 
				
			||||||
    converts each scanline of data from 8 bit to 32 bit aligned
 | 
					    converts each scanline of data from 8 bit to 32 bit aligned
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bits_per_pixel = {"1": 1, "L": 8, "P": 8}[mode]
 | 
					    bits_per_pixel = {"1": 1, "L": 8, "P": 8, "I;16": 16}[mode]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # calculate bytes per line and the extra padding if needed
 | 
					    # calculate bytes per line and the extra padding if needed
 | 
				
			||||||
    bits_per_line = bits_per_pixel * width
 | 
					    bits_per_line = bits_per_pixel * width
 | 
				
			||||||
| 
						 | 
					@ -167,6 +167,8 @@ def _toqclass_helper(im):
 | 
				
			||||||
    elif im.mode == "RGBA":
 | 
					    elif im.mode == "RGBA":
 | 
				
			||||||
        data = im.tobytes("raw", "BGRA")
 | 
					        data = im.tobytes("raw", "BGRA")
 | 
				
			||||||
        format = qt_format.Format_ARGB32
 | 
					        format = qt_format.Format_ARGB32
 | 
				
			||||||
 | 
					    elif im.mode == "I;16":
 | 
				
			||||||
 | 
					        format = qt_format.Format_Grayscale16
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        if exclusive_fp:
 | 
					        if exclusive_fp:
 | 
				
			||||||
            im.close()
 | 
					            im.close()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user