3rdEnlarging - "sourceCol: ",...

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

View Full Document Right Arrow Icon
from cImage import* def double(oldimage): oldw = oldimage.getWidth() oldh = oldimage.getHeight() newim = EmptyImage(oldw*2,oldh*2) sourceRow = 0 for row in range(newim.getHeight()): sourceCol = 0 for col in range(newim.getWidth()): oldpixel = oldimage.getPixel(int(sourceCol), int(sourceRow)) newim.setPixel(col,row,oldpixel) sourceCol = sourceCol + 0.5 print("targetRow:", row, "targetCol: ", col, "sourceRow:", sourceRow,
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: "sourceCol: ", sourceCol) sourceRow = sourceRow + 0.5 return newim oldimage = FileImage("guy.gif") oldw = oldimage.getWidth() oldh = oldimage.getHeight() myimagewindow = ImageWin("new",oldw*4, oldh*4) newim = double(oldimage) newim.draw(myimagewindow) myimagewindow.exitOnClick() #pixel by pixel it shows the position as its laid out #...
View Full Document

This document was uploaded on 12/14/2010.

Ask a homework question - tutors are online