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()
I built a viewer for our semiconductor wafer maps (upwards of 250k per wafer). We take the input data from a raw results file (txt, int data) and build a SVG using ElementTree to make the xml, convert the resulting SVG to base64 and display it inline in Perspective. Works great (and just about the only way of not crashing the client/gateway). I did try the image route, but ultimately found SVG more flexible and better performance.
(1) "Peter Dollars"™ are a brand new virtual currency that I designed solely for the purchase of NFTs. The main characteristic is that the exchange rate with fiat currencies is both arbitrary and capriciously in my favor at all times.
Marked @JordanCClark as the solution, but thanks everyone for the help! Got it working today. Now for the team to decide how to display this in a way that is meaningful (as several of you pointed out as a flaw).