Jo Jerrica Decker
7 years ago
2 changed files with 76 additions and 0 deletions
@ -0,0 +1,75 @@ |
|||
from tkinter import * |
|||
from copy import deepcopy |
|||
from struct import unpack |
|||
|
|||
def main(): |
|||
master = Tk() |
|||
|
|||
w = Canvas(master, width=144, height=80) |
|||
w.pack() |
|||
|
|||
w.create_rectangle(0, 0, 144, 80, fill="black") |
|||
|
|||
with open("OddParents.bin", "rb") as f: |
|||
f.seek(5480) |
|||
video = [] |
|||
audio = [] |
|||
r_first = True |
|||
|
|||
for blocks in range(0, 1920): |
|||
# print(f.tell()) |
|||
# input("hit enter...") |
|||
|
|||
for byte in range(0, 9): |
|||
current_byte = f.read(1) |
|||
# print(current_byte) |
|||
|
|||
video.append(getNibble(current_byte, True)) |
|||
video.append(getNibble(current_byte, False)) |
|||
|
|||
audio.append(f.read(1)) |
|||
|
|||
for y in range(0, 80): |
|||
line1 = deepcopy(video[0:216]) |
|||
line2 = deepcopy(video[216:432]) |
|||
|
|||
# print(video) |
|||
|
|||
# print(line1) |
|||
# print(video[0:216]) |
|||
# print(line2) |
|||
# print(video[216:432]) |
|||
|
|||
# input("hit enter...") |
|||
|
|||
del video[0:432] |
|||
|
|||
for x in range(0, 144): |
|||
if(r_first): |
|||
r = line1.pop(0) |
|||
g = line2.pop(0) |
|||
b = line2.pop(0) |
|||
else: |
|||
r = line2.pop(0) |
|||
g = line1.pop(0) |
|||
b = line1.pop(0) |
|||
|
|||
|
|||
r_first = not r_first |
|||
|
|||
colorval = "#%01x%01x%01x" % (r, g, b) |
|||
print(x, y, ": ", colorval) |
|||
|
|||
w.create_line(x, y, x+1, y, fill=colorval) |
|||
|
|||
mainloop() |
|||
|
|||
def getNibble(byte, nibble): |
|||
print(byte) |
|||
if(nibble): |
|||
return unpack("<B", byte)[0]>>0x04 |
|||
else: |
|||
return unpack("<B", byte)[0] & 0x0F |
|||
|
|||
if __name__ == "__main__": |
|||
main() |
@ -0,0 +1 @@ |
|||
{"last_check":"2017-12-23T16:19:21Z","pypi_version":"9.0.1"} |
Loading…
Reference in new issue