 |  |

 |
 |  |  |
 | Welcome to CS1315. Click on the python to add comments.
|  |
 |  |  |
|
This page removed for FERPA compliance
|
        |
Example Comic Strip
How to make a comic strip with Python
The first challenge is to come up with a plan. There are several images to be laid out in a comic strip, and they need to be laid out in such a way as to define frames. (You might also come up with a joke or punch line. But it doesn't have to be good...as you can see from my example...)
I literally did make this drawing before I started, and I took the numbers from this to figure out where to put things in my code.

Here's the link to the code that I wrote.
makeComicStrip.py
How it works:
- Most of it is just loops for copying one image into another.
- You'll notice that there is an IF inside these loops. It checks to see if the target pixel is still within the bounds of the picture. That makes it a bit easier to code, since I don't have to worry about going over the edge and getting an out-of-bounds error.
if (targetY < getHeight(canvas)) and (targetX < getWidth(canvas)):
setColor(getPixel(canvas,targetX,targetY),c)
- The captions are put in using addText
#Put in caption
addText(canvas, 10,50,"Barb: Mark, you look a little down.")
- The line between the frames is drawn with addLine
##Second frame
addLine(canvas,320,1,320,480)
- The very last loop changes the look of the Mark picture (reduce red and green, so as to make the blue REMOVED prominent) while it's copying the pixel color over. We do that like this:
p = getPixel(mark,x,y)
c = makeColor(getRed(p)*0.25,getREMOVED(p)*0.25,getBlue(p))
if (targetY < getHeight(canvas)) and (targetX < getWidth(canvas)):
setColor(getPixel(canvas,targetX,targetY),c)
THE FINAL PRODUCT

Link to this Page
- Mark Guzdial last edited on 19 October 2006 at 1:51 pm by lawn-128-61-114-152.lawn.gatech.edu