Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Colored ASCII Art from Pictures

by bastard (Hermit)
on May 02, 2001 at 03:24 UTC ( [id://77176]=note: print w/replies, xml ) Need Help??


in reply to Colored ASCII Art from Pictures

Here are a few threads that cover similar topics.
Pixel by Pixel reading of images
Image to table converter (i did this one)
one of merlyns webtechniques columns

I like using the GD module, and from what I hear it's much faster than Image::Magick.

What I might do to implement this:
read up the image file
GD.pm
create a matrix of the pixels and color intensities
Build a sub that returns the intensity based on the rgb.
define some characters that would work as shades of gray intesities
trial and error, perhaps analysing a single font of characters assigning a value based on positive coverage in a fixed area (fixed width fonts only)
this would be worked out ahead of time and set into a file or array for the generation of the final product
match neighbour colors inside a certain range as one color re-formatting the matrix
Build a sub to do that, run the foreach loops for x and y of the image like thus (x = 2; x < size; x = x + 3) if a 3x3 sample size was desired
another thing might be to look into the available modules and see if they support resizing, then do that first (or you could always require that the input file be sized already)
print out the html file based on the matrix.
Lots 'o print statements. I'd probably be printing to standard out during the x and y iterations of the pixels, converting each pixel and printing one line at a time.

Hope it helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://77176]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found