Fancy ASCII Graphics?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Kalle Kola
Forum Newbie
Posts: 2
Joined: Fri Apr 25, 2003 2:26 am

Fancy ASCII Graphics?

Post by Kalle Kola »

Hello all!


I have a question about rendering ASCII-Characters. I'm trying to use
the GD-lib to create png-files with ASCII-art and i wonder if it's possible
to render the fancy characters between 176 and 223 in the ASCII characterchart?

I'm using WindowsXP, Apache 1.3.27, PHP 4.3
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

[offtopic]
There was allready a kind of ascii art in php.

Was a jpg2txt. It just took a look at the color, and give the letter that collor. Not realy ascii-art but the effect was realy nice.
[/offtopic]
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

also off topic slightly

the .gd file format (old version of .gd2) uses single character per pixel data storage for low (under 257) colour images so you could just output a imagegd() call and then monospace the resultant file forcing line breaks at the line break characters (something like \Y or \Y!)

as to rendering ascii - if a loop doesn't render the set I doubt anything you did with GD would - might be your browser though.

<script type="text/javascript">
for (n=0; n<257; n++)
{
document.write('char number ' +n+ ' looks like &#' +n+ '<br />');
}
</script>

if that doesn't output the characters then blame your browser.

subnote: how are you currently reading the image? stepping through it a pixel at a time and using imagecolorat - imagecolorsforindex and the $v[0]+[1]+[2] / 3 ? - just wondered.
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

[offtopic]
I found the url of the script @ zend
see pref. post.
[/offtopic]
Kalle Kola
Forum Newbie
Posts: 2
Joined: Fri Apr 25, 2003 2:26 am

Post by Kalle Kola »

Thanks guys!
Post Reply