worksnegative - height = oldimage.getHeight newim =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
from cImage import * def negativePixel(oldPixel): newred = 255 - oldPixel.getRed() newgreen = 255 - oldPixel.getGreen() newblue = 255 - oldPixel.getBlue() newPixel = Pixel(newred, newgreen, newblue) return newPixel def makeNegative(imageFile): myimagewindow = ImageWin("Image Processing",600,600) oldimage = FileImage(imageFile) oldimage.draw(myimagewindow) width = oldimage.getWidth()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: height = oldimage.getHeight() newim = EmptyImage(width,height) for row in range(height): for col in range(width): originalPixel = oldimage.getPixel(col,row) newPixel = negativePixel(originalPixel) newim.setPixel(col,row,newPixel) newim.setPosition(width+1,0) newim.draw(myimagewindow) myimagewindow.exitOnClick() makeNegative("guy.gif")...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online