-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
31 lines (22 loc) · 756 Bytes
/
Copy pathtest.py
File metadata and controls
31 lines (22 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from cImage import *
def redPixel(pixel):
intensity = pixel.getRed()
aveRGB = intensity
newPixel = Pixel(aveRGB, 0, 0)
return newPixel
def makeRedScale(imageFile):
oldImage = FileImage(imageFile)
width = oldImage.getWidth()
height = oldImage.getHeight()
myImageWindow = ImageWin("Enhanced Red", width * 2, height)
oldImage.draw(myImageWindow)
newIm = EmptyImage(width, height)
for row in range(height):
for col in range(width):
oldPixel = oldImage.getPixel(col, row)
newPixel = redPixel(oldPixel)
newIm.setPixel(col, row, newPixel)
newIm.setPosition(width + 1, 0)
newIm.draw(myImageWindow)
myImageWindow.exitOnClick()
makeRedScale("butterfly.gif")