Skip to content

Commit eb1b866

Browse files
committed
Fix truncated PNG generated
1 parent 2e92997 commit eb1b866

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/turing-theme-extractor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import sys
2525

2626
PNG_SIGNATURE = b'\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'
27-
PNG_IEND = b'IEND'
27+
PNG_IEND = b'\x49\x45\x4E\x44\xAE\x42\x60\x82'
2828

2929
MIN_PYTHON = (3, 7)
3030
if sys.version_info < MIN_PYTHON:
@@ -65,7 +65,7 @@
6565
# Extract PNG data to a file
6666
theme_file.seek(header_found)
6767
png_file = open('theme_res_' + str(header_found) + '.png', 'wb')
68-
png_file.write(theme_file.read(iend_found-header_found))
68+
png_file.write(theme_file.read(iend_found - header_found + len(PNG_IEND)))
6969
png_file.close()
7070

7171
print("PNG extracted to theme_res_%s.png" % str(header_found))

0 commit comments

Comments
 (0)