Project idea - ASCII photographs!

Project idea - ASCII photographs!

by Deleted user -
Number of replies: 2

Here's another idea for a group project, use a raspberry pi or laptop to take a picture, convert that picture to ASCII art (an image made of keyboard characters).  If it works well or we're particular enthusiastic we could then try making an ASCII webcam!

This could be a cool project because we could set up on a table at events, take peoples photographs and offer a printout for a dollar to raise money for the club.  I bet I'd pay a dollar for a novelty printed ASCII photograph of myself, wouldn't you?

This project would require quite a few artistic decisions and would benefit from someone with some artistic talent or interest in typesetting, because there would be lots of details like choice of fonts, text size and colors or if we use color at all.  It would also have plenty of programming challenges interpreting the pixels of an image and choosing the right character.

If you're interested or have suggestions, write a reply!

In reply to Deleted user

Re: Project idea - ASCII photographs!

by Deleted user -

Last night I came back to this idea and kicked it around a bit in my head.  I did a little research and I think the concept is sound, there are plenty of photo-to-ASCII converters out there, many written in Java or C.  So I decided to give it a shot and created a github repo for the project in case anyone else feels like working on it with me, or simply wants to look at the code later.  Here's a link to the github repo, which by the way, they offer free to students with a .edu email address.

I'm writing it in Java and my plan is to start simple:

1) Break an image into blocks of pixels.  I'm starting out by assuming the picture will end up being 80 characters across in ASCII, so I'm dividing the image width by 80 to find the width of each block of pixels.  I haven't settled on a formula for height, so I'm using height/80 to keep it proportional.  The dimension formula needs work but I'll come back to this, maybe let the user decide?

2) For each block, find the average brightness by iterating over the pixels, getting their RGB values, and dividing by 3 to effectively convert it to greyscale.  Add all the greyscale values together and divide by the number of pixels in the block to get an average for the entire block.  Use that number to select a character with a relatively similar brightness from a list of ~10-20 characters.

So far I can break the image into blocks, and I have the average brightness for each block.  I hope to convert that brightness to a character today and maybe get a messy working version going by the end of the weekend.  I'd like to have a half decent working version before summer term starts and I get lost in homework.

I'm trying to learn how to use github and practice working with others, so I'd like to invite anyone/everyone to offer suggestions or contribute to the code.  I'll post back here when/if I reach any milestones and keep the thread updated.

In reply to Deleted user

Re: Project idea - ASCII photographs!

by Deleted user -

Hah, so far so good!  Here is my sample output and the original image (same as my profile pic here).

I can see it needs some work.  The original image's aspect ratio is 16/9, but my ascii ouput is 1/1, so the image is being stretched vertically.  Also, I'm only using 10 characters and the default font because typography is hard.  I should go talk to the art department and find a student who likes working with fonts, to optimize selecting the right character for a block of pixels.

Still, it feels like a good first step.