mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Fix 9-bit JPEG 2000 images not using I;16
This commit is contained in:
		
							parent
							
								
									19cd94bdb3
								
							
						
					
					
						commit
						ce060a8e8b
					
				
							
								
								
									
										
											BIN
										
									
								
								Tests/images/9bit.j2k
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/9bit.j2k
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -446,3 +446,9 @@ def test_plt_marker() -> None:
 | 
				
			||||||
        hdr = out.read(2)
 | 
					        hdr = out.read(2)
 | 
				
			||||||
        length = _binary.i16be(hdr)
 | 
					        length = _binary.i16be(hdr)
 | 
				
			||||||
        out.seek(length - 2, os.SEEK_CUR)
 | 
					        out.seek(length - 2, os.SEEK_CUR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_9bit():
 | 
				
			||||||
 | 
					    # Test 9-bit images are decoded to I;16
 | 
				
			||||||
 | 
					    with Image.open("Tests/images/9bit.j2k") as im:
 | 
				
			||||||
 | 
					        assert im.mode == "I;16"
 | 
				
			||||||
 | 
					        assert im.size == (128, 128)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -114,7 +114,7 @@ def _parse_codestream(fp):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    size = (xsiz - xosiz, ysiz - yosiz)
 | 
					    size = (xsiz - xosiz, ysiz - yosiz)
 | 
				
			||||||
    if csiz == 1:
 | 
					    if csiz == 1:
 | 
				
			||||||
        if (yrsiz[0] & 0x7F) > 8:
 | 
					        if (yrsiz[0] & 0x7F) + 1 > 8:
 | 
				
			||||||
            mode = "I;16"
 | 
					            mode = "I;16"
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            mode = "L"
 | 
					            mode = "L"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user