ini2png /

Filename Size Date modified Message
examples
src
1.0 KB
1.6 KB
526 B

ini2png

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.

Example

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

# npm install -g ini2png
[snip]
$ ini2png test.txt
Done!
$ feh test.png

Format

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.

Colour

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.

Content

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.

Example

.......xxxx
...xxxxxxxxxxx

is treated the same as

.....xxxx...
xxxxxxxxxxxx

...where dots represent spaces.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.