asciitools.uu - 14.840 Kb - 14jun98
original unix source-code material uuencoded tar gzip
========================================================================
From: jsbell@acs.ucalgary.ca (Joshua Bell)
Newsgroups: rec.arts.ascii,alt.binaries.pictures.ascii,alt.ascii-art,alt.binaries.pictures.utilities
Subject: [TECHNICAL] ASCII Tools (was Re: Flipping ASCII Pictures)
Date: 31 Jul 1994 08:58:59 -0500
Organization: University Computing Services (The University of Calgary)
Lines: 297
Sender: boba@gagme.wwa.com
Approved: boba@wwa.com
Message-ID: <31gan3$1l0@gagme.wwa.com>
NNTP-Posting-Host: gagme.wwa.com
Here's a short collection of Unix utilities for manipulating ASCII pictures.
Contents:
asciitool.c - Source posted in parent article, somewhat debugged.
Does "raw" flips (no remapping)
lr - /bin/sh script that flips ASCII left to right
and maps character shapes (eg, [ --> ] )
Here's a legal blurb from lr:
# Copyright (C) 1994 by Jef Poskanzer.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation. This software is provided "as is" without express or
# implied warranty.
tb - Similar utility that does top-bottom flipping
Requires asciitool
cw90 - Does clockwise 90 rotations. Requires asciitool
ccw90 - Does counterclockwise 90 rotations. Requires asciitool
The four shell scripts are rather simple. They simply use
asciitool (lr uses "rev", actually) then use tr to process the
output through a mapping of characters.
Syntaxes:
asciitool -{mh|mv|r90|r180|r270} [Infile [Outfile]]
-mh Mirror horizontally
-mv Mirror vertically
-r90 Rotate 90 degrees counterclockwise
-r180 Rotate 90 degrees counterclockwise
-r270 Rotate 90 degrees counterclockwise
lr [Infile]
tb [Infile]
cw90 [Infile]
ccw90 [Infile]
(Infile defaults to standard input, Outfile defaults to standard output)
For example:
lr picture | tb > picture_rotated_180_degrees
cal | asciitool -r90
Note: None of these utilities rescale images or attempt to do
anything beyond the scope of a single character cell. So rotated
images are almost always going to be extremely distorted.
Examples: ($ is my prompt)
$ cat genie
_.---.__
.' `-.
/ .--. |
\/ / / |_/
`\/|/ _(_)
___ /|_.--' `. .
\ `--' .---. \ /|
) ` \ //|
| __ __ | '/||
|/ \ / \ / ||
|| | | \ \ |
\| | | / |
__\\@/ |@ | ___ \--'
( /' `--' __)|
__> ( . .--' &"\
/ `--|_/--' & |
| #. |
| q# |
\ ,ad#'
`.________.ad####'
`#####""""""''
`"
"&
"#ba"
$ lr genie
__.---._
.-' `.
| .--. \
\_| \ \ \/
(_)_ \|\/'
. .' `--._|\ ___
|\ / .---. `--' /
|\\ / ' (
||\` | __ __ |
|| \ / \ / \|
| / / | | ||
| \ | | |/
`--/ ___ | @| \@//__
|(__ `--' `\ )
/"& `--. . ) <__
| & `--\_|--' \
| .# |
| #p |
`#ba. /
`####ba.________.'
``""""""#####'
"#&'
&" #&
"ad#"
$ tb genie
.#Pa.
.&
,.
,#####........
,'~~~~~~~~'ad####.
/ `ad#.
| d# |
| #' |
\ ,--|~\--. & |
~~> ( ' '--. &./
( \. ,--. ~~)|
~~//@\ |@ | ~~~ /--.
/| | | \ |
|| | | / / |
|\ / \ / \ ||
| ~~ ~~ | .\||
) , / \\|
/ ,--. '---' / \|
~~~ \|~'--. ,' '
,/\|\ ~(~)
/\ \ \ |~\
\ '--' |
'. ,-'
~'---'~~
$ tb genie | lr
.aP#.
&. #&
.#&.
........#####.
.####ba`~~~~~~~~`.
.#ba' \
| #b |
| `# |
| & .--/~|--. /
\.& .--` ` ) <~~
|(~~ .--. ./ )
.--\ ~~~ | @| /@\\~~
| / | | |\
| \ \ | | ||
|| / \ / \ /|
||/. | ~~ ~~ |
|// \ . (
|/ \ `---` .--. \
` `. .--`~|/ ~~~
(~)~ /|/\.
/~| / / /\
| `--` /
`-. .`
~~`---`~
$ cw90 genie
--\
/ |
/ |n
. v | /|
/| / |/---u |
/#| | /--\ | /\
:&| | / | / /\ .
####| -n @ | | / \
b :#| | \\--/ /|\\ |
a: #| \ \ \--\ .
:& :| |. |\ |
:| | /---\ .. \ |
:. \ |@ | || . |
:a .| | || | .
:d |\- / |\ | |
:# | \/ . | . |
\#\ \ | / n- /
\#a || - || |
#dq#&&|| u\ .
\##. :u / -
\ /-/ .
--- | /\\ /
| \\
\ --\\
------.
$ ccw90 genie
.------
\\-- \
\\ |
/ \\/ | ---
. /-/ \
- / n: .##\
. \n ||&qd#
| || - || a#\
/ -u / | \ \#\
| . | . /\ | #:
| | \| / -\| d:
. | || | |. a:
| . || | @| \ .:
| \ .. \---/ | |:
| \| .| |: &:
. \--\ \ \ |# :a
| \\|/ /--\\ | |#: b
\ / | | @ u- |####
. \/ / | / | |#&&:
\/ | \--/ | |#/
| n---/| / |/
|/ | ^ .
u| /
| /
\--
Joshua
========================================================================
| TOP |
Copyright © CJRandall_1998