
Pixel graphics in terminal - potatoPhD
https://github.com/asciimoo/drawille/
======
etfb
I learned Turbo Pascal in an MS-DOS emulator running on old green-screen
Burroughs smart terminals, circa 1987. I knew the terminals had some sort of
graphics capacity because their font changed when they left VMS mode and
started emulating MS-DOS, so I wrote a program to rummage around in memory
until I found where the font designs were stored. Then I wrote a font editor
that changed the standard font whenever I logged in, to a design based on my
own handwriting. After that, I took a leaf out of the Microbee computer's
books and emulated hi-res graphics: I wrote a program that printed all the
ASCII characters from 33 to 255 in a rectangle, set their font definitions to
all zeroes, and then selectively set individual pixels back on according to a
pattern that assumed the exact layout of characters. Implemented line, circle,
flood fill and a few other graphics primitives. Fun!

~~~
thom
Ah, cool. You used to be able to define your own characters on Amstrads, and
that's how I wrote most of my first games.

~~~
etfb
Pretty sure it was the way hi-res graphics worked on the VIC-20 too -- 22
characters by 8 pixels per character = 176 pixels wide, multi-colour mode
where each block of 8x8 pixels had a background and a foreground colour.
Deeply freaky.

~~~
bch
The Vic also had a mode whereby you could make "double height" characters
(halving the number of addressable rows), so when you typed "a", it would emit
(iirc):

    
    
      a
      b
    

and when you typed "b", it would emit:

    
    
      c
      d
    

When I was about 8, I fooled with this peeking and poking pixels so that "a"
and "b" bitmaps where the top and bottom halves of a double-height "a",
through to the end of the alphabet. I imagined that this would make it easy
for my grandparents to use computers. Never mind that they couldn't type, had
no interest, and would never remember commands like "load $,8,1".

edit: formatting

------
jevinskie
I think [0] is an example of what Terry (TempleOS [dead]) is talking about.
Graphics certainly give the terminal a fun feel! =)

(sound warning, there are some very raw tones)

[0]:
[https://www.youtube.com/watch?feature=player_detailpage&v=EV...](https://www.youtube.com/watch?feature=player_detailpage&v=EViG0Q4lTeA#t=219)

P.S. The REPL command line in TempleOS is very cool. You can even disassemble
your shell functions.

~~~
dlsym
He and his OS seem pretty much alive
[http://www.templeos.org/Wb/Doc/ChangeLog.html](http://www.templeos.org/Wb/Doc/ChangeLog.html)

~~~
jevinskie
Oh, I was referring to the [dead] comment, not Terry nor his OS.

------
chuckup
So why don't we have full blown graphics/widgets in the terminal?

I'm thinking a hybrid console meets explorer: When I type "ls *.png", why
don't I get a sortable table? Or, if I mouseover a filename, get a preview?

I remember "type BBSAD.ANS" in the DOS days - you'd see an animated ANSI right
in the terminal - but I can't type "view lolcat.png" in 2014 (without shifting
focus to the GUI).

Maybe this is overkill and not worth it, but I've always felt there's room to
make the CLI a little more GUI-like

~~~
eschaton
You mean like the command line on Lisp machines, such as this example from
Symbolics Genera?
[https://www.youtube.com/watch?v=o4-YnLpLgtk](https://www.youtube.com/watch?v=o4-YnLpLgtk)

The command line is contextually intelligent and presents interactive graphics
and text. Not a simulation of a teletype on a simulation of a character
terminal.

~~~
mietek
Thank you for sharing this video.

There's an Alpha workstation in my closet, waiting to have OpenGenera
installed...

------
ChuckMcM
I've got a couple VT340's in storage, they have ReGIS graphics on them which
is quite fun. It would be great if someone decided to implement ReGIS in one
of the Linux or Mac terminal emulators because all those cool DEC BASIC games
would suddenly work great.

[1]
[http://terminals.classiccmp.org/wiki/index.php/DEC_VT340](http://terminals.classiccmp.org/wiki/index.php/DEC_VT340)

~~~
LukeShu
Plain old xterm has a VT340 mode (`-ti vt340`) that supports ReGIS. I'm not
sure whether it is complete enough for games to work.

~~~
thristian
I don't know how much ReGIS it supports, but it very definitely supports sixel
graphics quite nicely:

[https://mediacru.sh/plKQQj7ymWNT](https://mediacru.sh/plKQQj7ymWNT)

The only limitation I've found is that the standard ppmtosixel conversion tool
spits out 8-bit control-characters, but xterm seems to only recognise their
7-bit equivalents (hence the sed command in that screenshot).

~~~
LukeShu
UTF-8 mode is interfering with the 8-bit control-characters. Give `+u8` to
disable UTF-8 mode.

------
minikomi
I think this is related too.. for 256 color terminals, a little off-the-cuff
go lib I wrote that converts pictures to blended colored ascii
[https://github.com/minikomi/ansipix](https://github.com/minikomi/ansipix)

------
b6
This is cool. Another earlier use of braille to draw in terms is aempirei's
Chat-Art[0] project. I've used it to make cool stuff like [1].

[0]: [https://github.com/aempirei/Chat-Art](https://github.com/aempirei/Chat-
Art) [1]: [http://i.imgur.com/iN24OEG.png](http://i.imgur.com/iN24OEG.png)

~~~
chinpokomon
But what does it say?

------
kilovoltaire
if you like this you'll also like spark, for sparklines in the terminal ▁▂▃▅▇

[https://github.com/holman/spark](https://github.com/holman/spark)

~~~
zx2c4
C implementation:

[http://git.zx2c4.com/spark/about/](http://git.zx2c4.com/spark/about/)

------
dspillett
A semi-related play-thing project (which seems to have stagnated completely
now: last update 2001 which makes me feel old) is AALib:
[http://en.wikipedia.org/wiki/AAlib](http://en.wikipedia.org/wiki/AAlib)

If you want to give yourself a migraine, try playing through Quake2 using that
as the output device...

~~~
VLM
mplayer, the video file player, also supports aalib as an output mode.

------
billpg
Back in university, we had lots of Falco t310 terminals. (VT100-esque
terminals connected to a serial port.)

Occasionally, I'd accidentally cat an executable file to the terminal and it
would sometimes switch to a graphical mode and draw lines on the screen like
an 80s BASIC program. Clearly there must be some control codes lurking in that
executable that coincidentally work as graphical instructions.

I tried experimenting with cutting the file up and into pieces to narrow down
the magic control codes, but the number of bytes with a value of 7 in that
file started annoying the people around me.

They replaced those terminals with Windows PCs the next year.

------
3JPLW
Why use braille when you can have a real image? A really awesome feature of
iTerm 2's new beta is the ability to display PNGs right inline with the
browser[1]. It's easy to use and can create some really cool effects[2].

[1]. Documentation:
[http://www.iterm2.com/images.html#/section/home](http://www.iterm2.com/images.html#/section/home)

[2]. Example usage:
[http://i.imgur.com/oOibjuT.png](http://i.imgur.com/oOibjuT.png)

~~~
gfixler
Nah, that's cheating. I like my restrictions. They keep me sharp.

------
viraptor
That reminds me of an old idea from lcamtuf (1st on
[http://lcamtuf.coredump.cx/soft/obsolete/STUPID_IDEAS.txt](http://lcamtuf.coredump.cx/soft/obsolete/STUPID_IDEAS.txt))
- replace fonts while text is being displayed directly on VGA/EGA. I wonder is
anyone attempted to implement it in the end. This project comes really close
though.

~~~
bane
I believe the old music software Impulse Tracker did something like this. It
was in text mode, yet had smooth mouse cursors, audio visualizations and other
"graphical" things.

[http://roartindon.blogspot.com/2014/02/20-years-of-
impulse-t...](http://roartindon.blogspot.com/2014/02/20-years-of-impulse-
tracker.html) (more detail from the author in the comments)

~~~
ashmud
A number of text mode programs had smooth mouse cursors. They modified
extended ascii characters to produce the effect. Some intros did some limited
animations (e.g., scrolling starry backgrounds) using the same approach. This
and cycling color palettes made for some pretty snazzy effects.

~~~
bane
You're right about that. For some reason I have it in my head that IT did
something more dynamic with the characterset to produce the graphics, but I
can't find the source for that other than the recent blog posts by Jeff Lim.

------
toleavetheman
This inspired me to make a Julia version:
[https://github.com/sunetos/DotPlot.jl](https://github.com/sunetos/DotPlot.jl)

It doesn't do arbitrary raster yet, but it has a cleaner syntax and prettier
graph than the python/javascript ones.

------
callesgg
Nice the last pice needed for a webkit browser in the terminal..

------
pasbesoin
It didn't have braille characters, but my old Kaypro 2x had a blocky,
character oriented form of pixel graphics. (The rather fat pixels needed to be
rolled together into a "character" that was outputted, as best as I recall.

It was enough to be able to display some chunky looking but workable fractal
images. Somewhat similar to the time I generated the like on a Dec something
or other and printed them on the available dot matrix printer.

Fun, if much simpler, times.

------
bitwize
Reminds me of the TRS-80 Model I, which could do "graphics" using special
characters in the space above ASCII 127. Each such character was a 2x3 pixel
grid with certain pixels turned "on" or "off". With 64 such characters, it was
possible to plot arbitrary monochrome graphics (albeit with really chunky
pixels) on the screen. Which is how Dancing Demon and other TRS-80 programs
got their famous chunky appearance.

------
ilaksh
I wonder if you could implement Mystery House in the terminal now.

Also maybe you could do color lines with ANSI.. although overlapping lines
wouldn't work.

~~~
couchand
Thanks for that! Things I learned from the WP page [0]:

\- Sierra was originally called _On-Line Systems_. A throwback to the Mother
of all Demos, perhaps?

\- There was a Japanese game company back in the 80s called _StarCraft_.

[0]:
[https://en.wikipedia.org/wiki/Mystery_House](https://en.wikipedia.org/wiki/Mystery_House)

~~~
dalke
If you want to get into the background of Mystery House - not how to play it
but more the background of how it was made and fits into the larger context of
interactive fiction - then you should read Jimmy Maher's description at
[http://www.filfre.net/2011/10/mystery-house-
part-1/](http://www.filfre.net/2011/10/mystery-house-part-1/) along with part
2. Those are part of a very long and enjoyable description of the evolution of
interactive fiction, the developers, and the computer systems.

However, the only description of the choice in using "On-Line" is a conjecture
in [http://www.filfre.net/2011/10/ken-and-
roberta/](http://www.filfre.net/2011/10/ken-and-roberta/) :

> Specifically, he wanted to bring FORTRAN, as it happens the implementation
> language of the original Adventure (not that Ken likely knew this or cared),
> to the little Apple II. With that purpose in mind, he registered a company
> of his own, choosing to call it On-Line Systems, a name fairly typical of
> the vaguely futuristic, vaguely compound, but essentially meaningless names
> (Microsoft, anyone?) that were so common in the era.

------
gfixler
I did this once, but not in such a general way.

[http://www.reddit.com/r/somethingimade/comments/ctk8c/i_made...](http://www.reddit.com/r/somethingimade/comments/ctk8c/i_made_a_braille_butterfly/)

------
chj
I am wondering if we could use same technique for displaying graph charts in
program comments. Let's hope the code points aren't overlapping.

------
snarfy
Reminds me of textro:

[https://www.youtube.com/watch?v=twBgcuaZVOA](https://www.youtube.com/watch?v=twBgcuaZVOA)

------
shmerl
Great idea, looks better than libcaca approximation.

