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
Fancy ASCII Graphics?
Moderator: General Moderators
-
pootergeist
- Forum Contributor
- Posts: 273
- Joined: Thu Feb 27, 2003 7:22 am
- Location: UK
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.
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.