1

I have a questions thats stumping me right now. I have to decrease the brightness of the bottom half of a picture. This is what I'm using so far. Its decreasing the brightness of the TOP half of my photo. How can I get it to decrease the bottom half? I know tat its somewhere in the third line I just can't figure it out. Any help would be greatly appreciated!

def bottomHalf(image):

  pixels = getPixels(image)

  for index in range(0,len(pixels)/2):

    pixel=pixels[index]

    value1=getRed(pixel)

    setRed(pixel,value1*.8)

    value2=getGreen(pixel)

    setGreen(pixel,value2*.8)

    value3=getBlue(pixel)

    setBlue(pixel,value3*.8)

  show(image)
falsetru
  • 357,413
  • 63
  • 732
  • 636
Warthog1
  • 123
  • 1
  • 2
  • 9

1 Answers1

2

I believe you need to do half the pixels, "but starting from half way through them rather than from the beginning", if I can put it like that!

So, replace this:

for index in range(0,len(pixels)/2):

with this:

for index in range(len(pixels)/2,len(pixels)):

Thanks to @MarkRansom for the correction.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432