def changeRed():
setMediaPath("/Users/addison/Downloads/Cmpt101_Pics/Learjet31A.jpg")
filename1 = "/Users/addison/Downloads/Cmpt101_Pics/Learjet31A.jpg"
source = makePicture(filename1)
halfHeight = getHeight(source)/2
for x in range(0,getWidth(source)):
for y in range(0, halfHeight):
pixel = getPixel(source, x, y)
value = getRed(pixel)
setRed(pixel, value-127.5)
show(source)
Sooo this is my code right now to select the top half of a picture and decresa the redness by 50%. My program also needs to select the bottom half of the picture and increase the redness by 50%, how do i go about doing this?
Pretty much add another for loop within the x in range loop but not in the for y loop you already have. This new for y in range loop should have a range of halfHeight,getHeight(source). Also subtracting -127.5 from red pixels isnt decreasing the red by 50%. Use value/2 instead.