AsciiWriter

From creative crowd wiki
Jump to navigation Jump to search


About asciiWriter

A python library to draw with plain text in ASCII art style (but with Unicode).

Install

$ pip3 install asciiwriter

Links

Gallery


Some thoughts

AsciiWriter is a Python library that can be used to generate plain text graphics and lay outs. The tool is embedded in a network of practices, scripts and events around OSP and Varia, in which plain text has been used to generate visuals and publications, such as the Data Workers, an exhibition catalog for Algolit (March 2019), a plaintext poster workshop at the Open Design Course at KASK (September 2019), Plaintext Partyline at Varia (April 2021) and a Peer-reviewed Newspaper made with asciiWriter (summer 2021).

My interest in plain text as a file format, environment and attitude, points to an engaged mode of computational meaning making. Plain text, with the X-Y axes as rigid constraints, embodies a monotone and spacial strictness of a monospace environment. Plain text can be an intimate space, with its manual possibilities to intervene in the drawing or lay out that you're making, or through its open ended range of possibilities for generating plain text material. Plain text can also be a fragile space, with its transformative, re-usable and its always-ready-to-be-re-rendered materiality, which comes to the surface when we think of plain text language corpora used for machine learning.

Matrix - matriz in Spanish, matris in Tagalog, the womb The intimate nature of an organization is visible in the way it holds information on its spreadsheets. To hold information womblike, allowing nutritive forces to find their way to what is being gestated. X, Y, axes to determine sex and maybe gender chromosomally. When an X-Y matrix is populated with information linearly, the possibility of curvature arises, of reading data on multiple hair-pin turns, down a column, through a row, and inter-lineally in other directions. It is this turning of attention on multiple tangent points that allows an anti-linear (?) reading. More than anti-linear, I would say it's hyperlinear. The greater the multiplicity of data points to turn on, the higher the possibility of representing fluid life forms. Am thinking about a drawing exercise I saw today on a meme account. It was an exercise from 1910. The instructions were to draw a cat using only angular lines.

Clara Balaguer, https://vvvvvvaria.org/plaintext-partyline/

Back to the asciiWriter! Turning asciiWriter into an pip-installable Python library was actually also an exploration in itself, both Gijs de Heij and myself had never done that before, and we were curious to give it a try. What does it mean to turn a bunch of scripts that are stored in git repo's here and there into something that is installable Python library? Would other people use and transform it? Do we need to maintain this library?

During the radio conversation Standards and work arounds, with Open Source Publishing (OSP), initiated by Simon Browne and myself in the context of the Publishing Partyline, the notion of tools was central to understanding what impact tool-making has on a design or publishing practice. What is the difference between a tool and a set of scripts? Is the gesture of turning something into a tool a gesture of claiming ownership and authorship? When we discussed the html2print project of OSP during the radio conversation, Alex, Gijs, Doriane and Amélie explained how the project first emerged as an experiment, but then grew into an approach and ecosystem. Something like a boilerplate that invites you to adapt it, a collection of hacks, or a tool chain. They preferred to look at it as a collection of practices, rather than a solid/fixed tool.

This way to think of tools can be applied to the asciiWriter as well. As much that this library is a short cut to a range of scripts, it also wraps as set of scripts into a tool, placing the spotlight on the scripts themselves instead of the thoughts, enthusiasms and practices that surround it.

It's actually not that much of a contradiction as i might make it sound now. And that's not my point. I'm interested in the placement of emphasis and what possibilities that placement produces.

An example script

Sinus-output.png

sinus.py

from asciiWriter.patterns import sinus_vertical
from asciiWriter.utils import make_lines, visit, print_lines, merge
from asciiWriter.marks import sentence, space

# Define width and height of the output
width = 70
height = 25

# As we draw multiple sinoids we will collect
# them in a list of layers
layers = []

# Loop through a range of X, X in steps of X
# (the amount of loops is the amount of layers)
for x in range(-50, 50, 5):
    # Set the pattern with the changing offset
    pattern = sinus_vertical(period=10, amplitude=40, offset=x)
    # We use a sentence to draw the text
    mark = sentence('▚▒▓▞')
    # Define a blank character
    blank = space('░')

    # Make the canvas
    lines = make_lines(width, height)

    # Draw the sinoid, but add it to the list
    result = visit(lines, pattern, mark, blank)
    # Add it the result to the list of layers
    layers.append(result)

# Merge the layers into one layer again
merged = merge(width, height, blank(), layers)

# Print the result
print_lines(merged)


Use asciiWriter

(Psst: this is incomplete documentation...)

marks

With marks you can specify what kind of text you are passing on to asciiWriter.

random()

sentence(str)

text(str)

single(str)

space(str)

patterns

You can draw patterns with the following functions.

diagonal(x, y, width, height, mark, blank)

Draw a diagnal line from top left to bottom right.

cross(x, y, width, height, mark, blank)

Draw two diagonals.

horizontal(y)

Draw horizontal line at given Y position.

vertical(x)

Draw a vertical line at given X position.

sinus_vertical(period=0.2, amplitude=0.5, offset_t=0, offset=0)

Draw a sinus shape vertically.

sinus_horizontal(period=0.2, amplitude=0.5, offset_t=0, offset=0)

Draw a sinus shape horizontally.

image(path, threshold=128)

Put marks based on a mask. Requires Pillow to be installed.

$ pip3 install pillow

text

utils

wrap_single_line