PDA

View Full Version : Image TO ACSII converter..



vasanth
02-19-2003, 07:17 AM
Well these days i am seeing a lot of ASCII graphics of images.. I am planing to build a progam which reads a BMP file and converts it into ASCII graphics.. I thought of doing something like this.. Based on the shade.. like black grey, red etc.. replace it by a given Char... But that will not be effective.. Any ideas..

Travis Dane
02-19-2003, 07:34 AM
Yeah, I've seen those funny converter, Although i have my
doubts if they are really chars. If i understand right it reads
the bmp for all it's pixels and converting them to char, Do this
chars have a single color each? Or do they just have a color
skin over them? If they all had a single color you'de need a VERY
big char field to represent the bmp or skip ALOT of pixels.

adrianxw
02-19-2003, 07:43 AM
Look at the font you are using for your ascii equivalent, in particular, the cell size of the character, (assuming fixed width - much easier). For the sake of argument, assume a cell size of 7 x 9 pixels per character. Okay, get the first seven by nine pixels from your bit map, data reduce that to black and white, then do a compare between that random 7 x 9 field and the first character in your font, award it a goodness of fit score, then the second character and so on, when you have cpmpared all characters, place the character with the best score in the first cell, then do the second cell. That is how I would start at least.

ygfperson
02-19-2003, 08:52 AM
Look at aalib. They have a text-graphics driver out which looks like what you're talking about.

beege31337
02-19-2003, 11:10 AM
How bout make a program that turns a bmp into html code.

like use tables and colors for each pixel.

of course the code will be much larger ( in byte size ) then just the bmp image, but it may be useful anyway for things like forums or signatures which allow html code but dont allow images.

or another option is to make the same program that takes in a text file as well and draws the image in the text by varying the color of each char. I've seen this done in magazine ads and it looks really cool.