Files

30 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Generiert PNG-Testbilder mit exakten Dimensionen auf orange-desktop
# Aufruf: bash generate-test-images.sh
HOST="${1:-orange@niklashmotion.art}"
ssh "$HOST" "python3 -c \"
import struct, zlib
def create_png(w, h):
def chunk(ctype, data):
c = ctype + data
crc = struct.pack('>I', zlib.crc32(c) & 0xffffffff)
return struct.pack('>I', len(data)) + c + crc
sig = b'\\\x89PNG\\r\\n\\x1a\\n'
ihdr = chunk(b'IHDR', struct.pack('>IIBBBBB', w, h, 8, 2, 0, 0, 0))
raw = b''
for y in range(h):
raw += b'\\x00' + bytes([(x+y) % 256 for x in range(w*3)])
idat = chunk(b'IDAT', zlib.compress(raw))
iend = chunk(b'IEND', b'')
return sig + ihdr + idat + iend
sizes = [(500, 400, 'small'), (2000, 1500, 'medium'), (5000, 3750, 'large'), (8000, 6000, 'xl')]
for w, h, label in sizes:
with open(f'/tmp/test-{label}-{w}x{h}.png', 'wb') as f:
f.write(create_png(w, h))
print(f'Created test-{label}-{w}x{h}.png')
\""
echo "Done. Test images on $HOST:/tmp/test-*.png"