Add build, deploy and test sources
This commit is contained in:
1 parent
b962581812
commit
3d1a08f230
259 files changed
+15273
No files matched your search
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
python3 - <<'EOF'
|
||||
import zlib, struct
|
||||
src='/tmp/k32b.ppm'; dst='/path/to/pf/KRD/xor32-krd-text.png'
|
||||
d = open(src, 'rb').read()
|
||||
parts = []; i = 0
|
||||
while len(parts) < 4:
|
||||
while d[i:i+1].isspace(): i += 1
|
||||
j = i
|
||||
while not d[j:j+1].isspace(): j += 1
|
||||
parts.append(d[i:j]); i = j
|
||||
i += 1
|
||||
w=int(parts[1]); h=int(parts[2]); px=d[i:i+w*h*3]
|
||||
raw=b''.join(b'\x00'+px[y*w*3:(y+1)*w*3] for y in range(h))
|
||||
def ch(t,dd):
|
||||
c=t+dd
|
||||
return struct.pack('>I',len(dd))+c+struct.pack('>I',zlib.crc32(c)&0xffffffff)
|
||||
png=b'\x89PNG\r\n\x1a\n'+ch(b'IHDR',struct.pack('>IIBBBBB',w,h,8,2,0,0,0))+ch(b'IDAT',zlib.compress(raw,9))+ch(b'IEND',b'')
|
||||
open(dst,'wb').write(png); print(dst,w,h)
|
||||
EOF
|
||||
Reference in new issue
Block a user