Eine einzelne index.html ohne Framework/CDN. Krypto + LSB-Steganografie laufen komplett im Browser (iOS-tauglich). Format-identisch zum CLI; Byte-Interop in beide Richtungen per Node-Test gegen das Python-CLI abgesichert (laedt den Krypto-Kern direkt aus der ausgelieferten index.html). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
722 B
Python
19 lines
722 B
Python
#!/usr/bin/env python3
|
|
"""Test-Helfer: PNG <-> rohes RGB-Byte-Array (nur für den Interop-Test)."""
|
|
import sys
|
|
from PIL import Image
|
|
|
|
if sys.argv[1] == "png2rgb": # png2rgb <in.png> <out.bin> -> stdout: "W H"
|
|
img = Image.open(sys.argv[2]).convert("RGB")
|
|
w, h = img.size
|
|
with open(sys.argv[3], "wb") as fh:
|
|
fh.write(bytes([v for px in img.getdata() for v in px]))
|
|
print(w, h)
|
|
elif sys.argv[1] == "rgb2png": # rgb2png <in.bin> <W> <H> <out.png>
|
|
w, h = int(sys.argv[3]), int(sys.argv[4])
|
|
data = open(sys.argv[2], "rb").read()
|
|
img = Image.new("RGB", (w, h))
|
|
img.putdata([tuple(data[i:i + 3]) for i in range(0, len(data), 3)])
|
|
img.save(sys.argv[5], "PNG")
|
|
print("ok")
|