#!/usr/bin/env python3 # Erzeugt das Prüfstand-Testbild deterministisch OHNE Zusatz-Pakete (reines # zlib/struct-PNG): weißer Grund 256x256, rotes Rechteck links oben, # blaues Rechteck rechts unten. Die Vision-Suite prüft genau diese Aussagen. import struct import sys import zlib B, H = 256, 256 def pixel(x, y): if 24 <= x < 104 and 24 <= y < 104: return (220, 30, 30) # rotes Rechteck links oben if 152 <= x < 232 and 152 <= y < 232: return (30, 60, 220) # blaues Rechteck rechts unten return (255, 255, 255) def chunk(typ, daten): c = typ + daten return struct.pack(">I", len(daten)) + c + struct.pack(">I", zlib.crc32(c)) roh = b"" for y in range(H): roh += b"\x00" + b"".join(bytes(pixel(x, y)) for x in range(B)) png = (b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", B, H, 8, 2, 0, 0, 0)) + chunk(b"IDAT", zlib.compress(roh, 9)) + chunk(b"IEND", b"")) ziel = sys.argv[1] if len(sys.argv) > 1 else "testbild.png" with open(ziel, "wb") as f: f.write(png) print(f"Testbild geschrieben: {ziel}")