Date

Lecture Date: Wednesday, November 30

We'll do some example programs from previous exams and talk about some of the things you might expect programming-wise on the final. Consider this exam review part 1.

Link to Coding Questions from Fall 2015 Final Exam

Link to Key to Fall 2015 Coding Questions

Rotate an image:

from cImage import *

# Prompt the user for a filename
file_name = 'mtn.gif' #input("Filename?: ")

clockwise = int(input("0 for Clockwise - 1 for Counter Clockwise:  "))

# Open an image
old_image = FileImage(file_name)

# Open a window that is twice the size of the original image
image_window = ImageWin("Image Processing", old_image.width, old_image.height)

# Draw the image on the window
old_image.draw(image_window)

# Create a new, blank image
new_image = EmptyImage(old_image.height, old_image.width)

new_image_window = ImageWin("Rotated", old_image.height, old_image.width)

# For each pixel in the original image...
for row in range(old_image.height):
    for col in range(old_image.width):
        # ... get the original pixel ...
        oldPixel = old_image.getPixel(col, row)

        # ... and draw it in the correct place in the new image!
        # Fill in your code here!

# Draw the new image
new_image.draw(new_image_window)

# Wait for a user to click the window to close the image
image_window.exitOnClick()