width = getWidth(image)
height = getHeight(image)
newPic = makeEmptyPicture(height, width)
for x in range(0, width):
for y in range(0, height):
pixel = getPixel(image,x,y)
color = getColor(pixel)
#switch x and y values for the new image,
#but flip on the x-axis to keep the
#image from flipping.
newPixel = getPixel(newPic, height - y-1, x)
Monday, November 23, 2009
The Elegance of Python
Just finishing up a class at UAB that teaches an introduction to computer programming using media computation in Python. Although Python certainly is strange, I have to say that this simple Rotate 90% function using a framework called JES in Jython is somewhat beautiful and elegant in how little code it takes to generate. This would be much more messy in .NET.