in reply to create PNG image

Write the numbers in binary (pack to a two byte word per number) and convert the raw binary file to PNG using imagemagick such as convert -size 64x64 -depth 16 gray:a.raw a.png (command untested). Alternately, write a PGM (grayscale PNM) file (whether text or binary) and convert that using imagemagick.