mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
		
							parent
							
								
									455ffff735
								
							
						
					
					
						commit
						f2dfd0bfb3
					
				| 
						 | 
					@ -175,6 +175,7 @@ def test_rle8():
 | 
				
			||||||
            with pytest.raises(ValueError):
 | 
					            with pytest.raises(ValueError):
 | 
				
			||||||
                im.load()
 | 
					                im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_rle4():
 | 
					def test_rle4():
 | 
				
			||||||
    with Image.open("Tests/images/hopper_rle4.bmp") as im:
 | 
					    with Image.open("Tests/images/hopper_rle4.bmp") as im:
 | 
				
			||||||
        assert_image_similar_tofile(im, "Tests/images/hopper_4bit.bmp", 12)
 | 
					        assert_image_similar_tofile(im, "Tests/images/hopper_4bit.bmp", 12)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -348,7 +348,7 @@ class BmpRle4Decoder(ImageFile.PyDecoder):
 | 
				
			||||||
                    # Too much data for row
 | 
					                    # Too much data for row
 | 
				
			||||||
                    num_pixels = max(0, self.state.xsize - x)
 | 
					                    num_pixels = max(0, self.state.xsize - x)
 | 
				
			||||||
                first_pixel = o8(byte[0] >> 4)
 | 
					                first_pixel = o8(byte[0] >> 4)
 | 
				
			||||||
                second_pixel = o8(byte[0] & 0x0f)
 | 
					                second_pixel = o8(byte[0] & 0x0F)
 | 
				
			||||||
                for index in range(num_pixels):
 | 
					                for index in range(num_pixels):
 | 
				
			||||||
                    if index % 2 == 0:
 | 
					                    if index % 2 == 0:
 | 
				
			||||||
                        data += first_pixel
 | 
					                        data += first_pixel
 | 
				
			||||||
| 
						 | 
					@ -379,11 +379,11 @@ class BmpRle4Decoder(ImageFile.PyDecoder):
 | 
				
			||||||
                    for byte_read in bytes_read:
 | 
					                    for byte_read in bytes_read:
 | 
				
			||||||
                        first_pixel = o8(byte_read >> 4)
 | 
					                        first_pixel = o8(byte_read >> 4)
 | 
				
			||||||
                        data += first_pixel
 | 
					                        data += first_pixel
 | 
				
			||||||
                        second_pixel = o8(byte_read & 0x0f)
 | 
					                        second_pixel = o8(byte_read & 0x0F)
 | 
				
			||||||
                        data += second_pixel
 | 
					                        data += second_pixel
 | 
				
			||||||
                    if len(bytes_read) < total_bytes_to_read:
 | 
					                    if len(bytes_read) < total_bytes_to_read:
 | 
				
			||||||
                        break
 | 
					                        break
 | 
				
			||||||
                    x += byte[0] 
 | 
					                    x += byte[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    # align to 16-bit word boundary
 | 
					                    # align to 16-bit word boundary
 | 
				
			||||||
                    if self.fd.tell() % 2 != 0:
 | 
					                    if self.fd.tell() % 2 != 0:
 | 
				
			||||||
| 
						 | 
					@ -392,6 +392,7 @@ class BmpRle4Decoder(ImageFile.PyDecoder):
 | 
				
			||||||
        self.set_as_raw(bytes(data), (rawmode, 0, self.args[-1]))
 | 
					        self.set_as_raw(bytes(data), (rawmode, 0, self.args[-1]))
 | 
				
			||||||
        return -1, 0
 | 
					        return -1, 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# =============================================================================
 | 
					# =============================================================================
 | 
				
			||||||
# Image plugin for the DIB format (BMP alias)
 | 
					# Image plugin for the DIB format (BMP alias)
 | 
				
			||||||
# =============================================================================
 | 
					# =============================================================================
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user