ini2png is a tool to convert images from a textual representation to png images. This could be handy for e.g. smaller pieces of pixel art.


ini2png provides a command-line tool with the same name.

# npm install -g ini2png
$ ini2png test.txt
$ feh test.png


The format that ini2png understands is based on the 'ini' configuration file format. It consists of two sections, Colour and Content.

All whitespace-only lines, as well as all lines beginning with a #, are ignored. The # has to be the first character of the line for it to be ignored.


The Colour section consists of key-value pairs of the form "key = value", where each key is a single (non-whitespace) character, and each value is a CSS colour.

Currently, only the formats #rgb, #rgba, #rrggbb, #rrggbbaa as well as a select subset of "named colours" (e.g. "transparent", "black", "red").

The Colour section basically makes up the palette of the image.


The Content section consists of the actual image. Each character in this section is replaced with the corresponding colour declared in the Colour section. Leading whitespace is removed from each line, but only up to the point so that each line begins at the same column. Lines are padded so that they all have equal length.

The space character () is special, and represents transparent pixels.



is treated the same as


...where dots represent spaces.