A curses-based pixel art tool.
More correctly, painterm is a actually a scriptable bitmap image editor which also provides a curses-based command line interface.
Painterm requires Python 3.5. If you already have that, installation is as:
pip3 install painterm
or cloning this repository and running:
python3.5 setup.py install
Once installed, the
painterm command will run the application. The applicatiion provides 4 function:
new: Create a new image
load: Load an existing image
bmp: Export to a .BMP file
pxon: Export to a .PXON file
right: Move the cursor
space: Draw a pixel at the current location
f: Flood fill at the current location
z: Undo the most recent draw (persists across sessions)
Z: Redo the most recent undone draw (persists across sessions)
1-9: switch to the nth-most-recently-used colour
[ABCDEFHIKLMNORST][abcdefhiklmnorst]change colour to selected palette colour (e.g.,
Atwill switch to a white).
d: switch to the colour under the cursor
s: Toggle snail mode (moving the cursor will cause it to draw first)
q: Quit painterm
Painterm saves automatically, so don't worry about it.
The heart of the painterm library is the
Image class (found in
painterm.image). It represents a bitmap image as an sqlite3 database. New images can
be created using:
image = Image.new_image(width, height)
This will load a new image into an in-memory database (the
path argument can be used to pass a
pathlib.Path to save the database to). This file can later be loaded using
By default, the image will have a transparent-white background, but an alternative can be set using the
background keyword. Colours in painterm are supplied as a four-tuple of (red, green, blue, alpha), where red, green, and blue are integers between 0 and 255, and alpha is a floating point number between 0 and 1. When returning colours, painterm will actually return the
Image provides two drawing methods:
fill. Both take
x, the 0-indexed horizontal coordinate,
y, the 0-indexed vertical coordinate, and
colour, an rgba 4-tuple.
Reading of pixels can be done using the
colour_at method, which takes
y as arguments, and returns the colour as a namedtuple.
The image can be resized using the
resize method. If new pixels are added, they will be given the initial background colour. If pixels are removed, their history will be removed with them.
redo exist and will step back or forward one transaction (probably, one call to
fill, although both methods take an argument
continue_transaction to allow multiple actions to be taken as one).
Images can currently be exported to either a BMP (using the
export_bitmap method), or PXON (using the
export_pxon method). There is not currently a way to import image files.
Painterm is provided under the Mozilla Public License 2.0