Showing posts with label Chapter 6. Show all posts
Showing posts with label Chapter 6. Show all posts
Friday, November 20, 2009
Wednesday, February 4, 2009
Chapter 6 -- Page 222 -- Exercise 6.23 typo
There is a typo in exercise 6.23. It should read "Write a general function for enlarging..."
Chapter 6 -- Page 220 -- Listing 6.9
This listing has transposed the width and height in lines 7 and 8. The row should iterate over the height and the column over the width. The correct version is:
def double(oldimage):
oldw = oldimage.getWidth()
oldh = oldimage.getHeight()
newim = EmptyImage(oldw*2,oldh*2)
for row in range(newim.getHeight()):
for col in range(newim.getWidth()):
originalCol = col//2
originalRow = row//2
oldpixel = oldimage.getPixel(originalCol,originalRow)
newim.setPixel(col,row,oldpixel)
return newim
Subscribe to:
Posts (Atom)