
The goals of this project are to practice:
In this task, you will make ASCII art out of an image.
Copy over the Zelle Graphics module to your project folder.
Download an updated version of exotic.ppm.
Make a new file called ascii_art_image.py.
Create an image filter, similar to the ones that you made in the Warhol project. Instead of modifying the image object, however, build up a single multiline string wherein characters reflect pixel values in the image:
ascii_art_image.py should print out the ASCII art string representation of the image and save it to a text file.Include an image of an example ASCII art output in your report. This is required image 1.
Notes:
Make another "filter" function that makes use three or more ASCII art characters based on ranges of average pixel values. Look at prior work by ASCII artists to see how others have represented images or ideas.
In your report section called Art Reflection discuss which ASCII artworks inspired you and what aspects of the compositions you emulated.
Include an image of an example ASCII art output in your report. This is required image 2.
For example, your program will take an input string, such as 'CS151', and produce one multi-line string, which when printed, looks like:

An ASCII art symbol is a multiline string that makes up an stylistic representation of one alphanumeric or punctuation character. Each line is a fixed number of string characters long (e.g. 15). The last character on each line is a new line character ('\n'). The total number of lines ("rows") making up the ASCII art symbol is also fixed (e.g. 11). For example, this multiline string makes up the ASCII art symbol for capital "A":
d8888
d88888
d88P888
d88P 888
d88P 888
d88P 888
d8888888888
d88P 888
Above, despite there being different numbers of visible characters on each line of the "A", each line is always 15 characters long when we count spaces and the new line escape sequence character (\n) at the very right. For example, the first line making up the "A" is more whitespace than non-whitespace, but is still 15 characters long because of whitespace.
The "empty, blank lines" at the bottom are still part of the symbol. While they are not needed for the "A" symbol, other alphanumeric symbols (e.g. "J") make use of the additional lines.
The ASCII ART font alphabet is the collection of all letters, numbers, and punctuation that we are capable of expressing with an ASCII art symbol. In the project, the font alphabet is: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789?!
With this font alphabet, we could convert "A" into ASCII art, but not "." (its symbol is missing from the font alphabet).
Make a new file called ascii_art_text.py.
We will be using an ASCII art font called colossal. You will need to download two text files to get started:
| Font alphabet | Font symbols |
|---|---|
| colossalFontAlphabet.txt | colossalFontSymbols.txt |
Your program will take in an input string from a command line argument, print out its ASCII art representation, and save the ASCII art to a text file.
For example:
python3 ascii_art_text.py CS151
should print out in the Terminal an ASCII art representation of 'CS151' in the colossal font:

You are free to structure ascii_art_text.py however you wish, but you should use the principles of top-down design to guide you (you should describe how you did this in your report).
You will be graded on code style, readability, and design best practices like usual (e.g. minimal top-level code, command-line argument usage statements, helpful variable/function names, docstrings, etc.)
To help get you started, here is "pseudocode" describing the high-level goals of the program:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789?!).'A', 'B', ..., '!'Include an image of an example ASCII art output in your report. This is required image 3.
I suggest testing your code as you go. Here things you should check for:
Should contain 64 characters: A thru Z, a thru z, 0 thru 9, and ?!
Assuming your dictionary is called asciiSymbolDict:
len(asciiSymbolDict.keys())).len(asciiSymbolDict['A']), len(asciiSymbolDict['B']), etc.). This corresponds to the number lines that compose each ASCII art symbol.len(asciiSymbolDict['A'][0]), len(asciiSymbolDict['A'][1]), etc.). This is the number of characters (all characters including whitespace and non-whitespace) making up each of the 11 lines of an ASCII art symbol.print('\n'.join(asciiSymbolDict['A'])) should reproduce the ASCII art symbol above for "A".Hint: If the length of each string is 15, you may not have removed new line characters.
Assuming the test input string Colby123, the length of the final ASCII art string should be 1242 (len(art_string)). Getting 1243 would be fine too.
The ASCII art string should occupy 11 lines (len(art_string.split('\n'))) when printed or written to a text file.
General: Roughly each of the above numbered steps should happen in a separate function. The functions should be called in roughly that order from a main function. Pass in only relevant data needed for each subtask as parameters, return the result(s) back to your main function.
Step 3: It would probably be easiest to use the (nested) for loop approach used in lab for reading from the file. Remember to strip out the new line characters as you read in each line!
Step 4: We want to concatenate the 1st lines of the ASCII art symbols representing all the characters in the input string, then add a new line character, concatenate together the 2nd lines of the ASCII art symbols representing all the characters in the input string, and so on. The dictionary should help you assemble each line of the final ASCII art string for the appropriate characters in the input string.
In order to grade your project, we need to be able to run your code and get the same results as you do! In your project submission ZIP file, please include any PPM images that are needed run your code (including exotic.ppm).
Here is a summary of the expected outputs from each of the source code files that you created:
python3 ascii_art_image.py: Makes an ASCII art version of exotic.ppm — either one of your 2 or 3+ character "filters".python3 ascii_art_text.py <a word>: Should print the word passed in as a command-line argument in ASCII art form.If you use command-line arguments, please explain what they are and provide an example way to run your code in either code comments or your report.
Congratulations on completing the core tasks! If your code and report meet the above expectations, you’ve already earned up to 26/30 points for this project.
The remaining 4/30 are a chance for you to earn credit for exploring parts of this project and digging deeper to express your creativity! This is entirely optional; 26/30 is a B and is a perfectly respectable place to stop. Extensions are open-ended and exist to compliment the structured core project. Explore and learn something new that interests you! Concentrating your energy on 1-2 "deep" extensions that challenge you will earn you more points than many small, "shallow" extensions.
You can pick your own topics that interest you. Here are a few examples:
join rather than string concatenation. Figure out how to time the runtime of a function in Python (i.e. number of seconds it takes to finish). Analyze differences in speed between the two approaches.Lab07 folder inside Project07).© 2021 Oliver Layton