import png import numpy as np # Generate a 1024x1024 random noise image to simulate an X-ray width = 512 height = 512 img = np.random.randint(0, 65535, (height, width)).astype(np.uint16) with open('data/test_xray.png', 'wb') as f: writer = png.Writer(width=width, height=height, greyscale=True, bitdepth=16) writer.write(f, img.tolist()) print("Created data/test_xray.png")