Skip to content

Commit f2dfd0b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 455ffff commit f2dfd0b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Tests/test_file_bmp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def test_rle8():
175175
with pytest.raises(ValueError):
176176
im.load()
177177

178+
178179
def test_rle4():
179180
with Image.open("Tests/images/hopper_rle4.bmp") as im:
180181
assert_image_similar_tofile(im, "Tests/images/hopper_4bit.bmp", 12)

src/PIL/BmpImagePlugin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def decode(self, buffer):
348348
# Too much data for row
349349
num_pixels = max(0, self.state.xsize - x)
350350
first_pixel = o8(byte[0] >> 4)
351-
second_pixel = o8(byte[0] & 0x0f)
351+
second_pixel = o8(byte[0] & 0x0F)
352352
for index in range(num_pixels):
353353
if index % 2 == 0:
354354
data += first_pixel
@@ -379,11 +379,11 @@ def decode(self, buffer):
379379
for byte_read in bytes_read:
380380
first_pixel = o8(byte_read >> 4)
381381
data += first_pixel
382-
second_pixel = o8(byte_read & 0x0f)
382+
second_pixel = o8(byte_read & 0x0F)
383383
data += second_pixel
384384
if len(bytes_read) < total_bytes_to_read:
385385
break
386-
x += byte[0]
386+
x += byte[0]
387387

388388
# align to 16-bit word boundary
389389
if self.fd.tell() % 2 != 0:
@@ -392,6 +392,7 @@ def decode(self, buffer):
392392
self.set_as_raw(bytes(data), (rawmode, 0, self.args[-1]))
393393
return -1, 0
394394

395+
395396
# =============================================================================
396397
# Image plugin for the DIB format (BMP alias)
397398
# =============================================================================

0 commit comments

Comments
 (0)