Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A curses-based pixel art tool.

Project Description

Painterm

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.

Installation

Painterm requires Python 3.5. If you already have that, installation is as: `sh pip3 install painterm `

or cloning this repository and running: `sh python3.5 setup.py install `

Application

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

Controls

  • up, down, left, 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., At will 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.

Library

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: `python 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 Image.load

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 painterm.colour.Colour namedtuple.

Image provides two drawing methods: draw, and 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 x and 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.

undo, redo exist and will step back or forward one transaction (probably, one call to draw, or 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.

License

Painterm is provided under the Mozilla Public License 2.0

Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
painterm-0.1.0.tar.gz (13.2 kB) Copy SHA256 Checksum SHA256 Source Nov 1, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting