Skip to content

Commit 0aed0e9

Browse files
committed
Initial Implementation
Transparency checking works, but there still may be efficient methods.
1 parent 3a62483 commit 0aed0e9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

adafruit_imageload/png.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ def load(
6161
height = 0
6262
while True:
6363
size, chunk = struct.unpack(">I4s", file.read(8))
64-
print("==================")
65-
print(size)
66-
print(chunk)
67-
print('====================')
6864
if chunk == b"IHDR":
6965
(
7066
width,
@@ -91,8 +87,10 @@ def load(
9187
for i in range(pal_size):
9288
pal[i] = file.read(3)
9389
elif chunk == b"tRNS":
94-
transparent = file.read(size)
95-
print(transparent)
90+
trns_list = list(file.read(size))
91+
indices = [i for i, x in enumerate(trns_list) if x == 0]
92+
for index in indices:
93+
pal.make_transparent(index)
9694
elif chunk == b"IDAT":
9795
data.extend(file.read(size))
9896
elif chunk == b"IEND":

0 commit comments

Comments
 (0)