Skip to content

Commit 1822cb3

Browse files
author
bstorm
committed
Merge remote-tracking branch 'origin/master' into ppm
2 parents 3414d18 + b57dadf commit 1822cb3

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

adafruit_imageload/pnm/__init__.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,21 @@
3030
"""
3131
# spec https://en.wikipedia.org/wiki/Netpbm_format
3232

33-
def load(f, header, *):
33+
34+
def load(f, header, *, bitmap=None, palette=None):
3435
# Read the header
3536
magic_number = header[:2]
36-
if magic_number.startswith(b'P1') or magic_number.startswith(b'P4'):
37+
if magic_number.startswith(b"P1") or magic_number.startswith(b"P4"):
3738
from . import pbm
38-
return pbm.load(f, magic_number)
39-
elif magic_number.startswith(b'P2') or magic_number.startswith(b'P5'):
39+
40+
return pbm.load(f, magic_number, bitmap=bitmap, palette=palette)
41+
elif magic_number.startswith(b"P2") or magic_number.startswith(b"P5"):
4042
from . import pgm
41-
return pgm.load(f, magic_number)
42-
elif magic_number.startswith(b'P3') or magic_number.startswith(b'P6'):
43+
44+
return pgm.load(f, magic_number, bitmap=bitmap, palette=palette)
45+
elif magic_number.startswith(b"P3") or magic_number.startswith(b"P6"):
4346
from . import ppm
44-
return ppm.load(f, magic_number)
47+
48+
return ppm.load(f, magic_number, bitmap=bitmap, palette=palette)
4549
else:
4650
raise RuntimeError("Unsupported image format")

0 commit comments

Comments
 (0)