The pypng library is a straight port. The attached script package has the pypng (png) library along with a couple of helper functions to process the DINTs to a list of lists suitable for pypng… File size stays about 480k
test_graphics_2021-09-02_1214.zip (24.0 KB)
import random
# Randomized Sample Data
sampleData = [random.randrange(0, 2**32) for j in xrange(120000)]
# Process the DINTs to a list of lists suitable for pypng (single-bit depth)
data, width, height = graphics.dint.processData(sampleData, 12)
# Define the color pallete
palette=[(0,0,0), (0,255,0)]
# Spin up a png writer.
writer = graphics.png.Writer(width, height, palette=palette, bitdepth=1)
# Open a file
f = open('c:/test/test.png', 'wb')
# Write the png data to the file.
writer.write(f, data)
# Close the file afterward
f.close()
File output: