I need to decrease the amount of red in a pixel by 50% on the top half of the image and then increase bottom half by 50%
def changeRed():
setMediaPath("/Users/addison/Downloads/Cmpt101_Pics/Learjet31A.jpg")
filename1 = "/Users/addison/Downloads/Cmpt101_Pics/Learjet31A.jpg"
source = makePicture(filename1)
halfWidth = getWidth(source)/2
for y in range(0,getHeight(source)):
for x in range(0, halfWidth):
pixel = getPixel(source, x, y)
value = getRed(pixel)
setRed(pixel, value-127.5)
show(source)
This is what I have right now, I'm not sure how to change it to make it halved on the X axis instead of the Y axis which it currently does right now..I have attempted to look everywhere for the solution but can't seem to find anything...Help Please
All you need to do is swap the
x
andy
in thefor
loops. For example