1
This commit is contained in:
parent
920656e181
commit
2b8ebc5148
4 changed files with 55 additions and 0 deletions
9
test.py
Normal file
9
test.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
import json
|
||||
with open("/tmp/map.json") as f:
|
||||
cmap = json.load(f)
|
||||
c = 0
|
||||
for y in range(1080):
|
||||
for x in range(1920):
|
||||
if str(c) not in cmap:
|
||||
print(f"{c=} {x=} {y=}")
|
||||
c+=1
|
21
test1.py
Normal file
21
test1.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import PIL.Image
|
||||
im = PIL.Image.open("/tmp/1.png")
|
||||
im = im.convert("RGB")
|
||||
c = 0
|
||||
mapping = {}
|
||||
mapping1 = {}
|
||||
for y in range(1080):
|
||||
for x in range(1920):
|
||||
r, g, b = im.getpixel((x, y))
|
||||
rc = (r << 16) + (g << 8) + b
|
||||
#assert c == rc, f"c={c:#08x} rc={rc:#08x} {r=} {g=} {b=}"
|
||||
assert type(rc) == int
|
||||
mapping[rc] = c
|
||||
mapping1[c] = rc
|
||||
c += 1
|
||||
|
||||
import json
|
||||
with open("/tmp/map.json", "w") as f:
|
||||
json.dump(mapping, f)
|
||||
with open("/tmp/map1.json", "w") as f:
|
||||
json.dump(mapping1, f)
|
10
test2.py
Normal file
10
test2.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
import PIL.Image
|
||||
import subprocess
|
||||
im = PIL.Image.new("RGB", (1920, 1080))
|
||||
c = 0
|
||||
for y in range(1080):
|
||||
for x in range(1920):
|
||||
im.putpixel((x, y), (c >> 16, c >> 8 & 0xff, c & 0xff))
|
||||
c += 1
|
||||
im.save("/tmp/1.png")
|
||||
subprocess.run(["ffplay", "-fs", "/tmp/1.png"])
|
15
test3.py
Normal file
15
test3.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import PIL.Image
|
||||
import subprocess
|
||||
import random
|
||||
im = PIL.Image.new("RGB", (1920, 1080))
|
||||
c = 0x000000
|
||||
color = (255, 255, 255)
|
||||
if 0:
|
||||
if c % 256 == 0:
|
||||
color = (random.randint(0, 256), random.randint(0, 256), random.randint(0, 256))
|
||||
for x in range(16):
|
||||
for y in range(16):
|
||||
im.putpixel((x+16*8*2, y+16*0), color)
|
||||
c += 1
|
||||
im.save("/tmp/1.png")
|
||||
subprocess.run(["ffplay", "-fs", "/tmp/1.png"])
|
Loading…
Reference in a new issue