Question

I am trying to show my picture as a negative, and I coded it, but it wont show the picture as a negative, did I do something wrong?

def negative(picButterfly2):
    for px in getPixels(picButterfly1):
        red=getRed(px)
        green=getGreen(px)
        blue=getBlue(px)
        negColor=makeColor(255-red, 255-green, 255-blue)
        setColor(px,negColor)

ALSO HOW DO I DRAW HORIZONTAL LINES? Thanks!

No correct solution

OTHER TIPS

Try with correct variables names: you have picButterfly2 NOT EQUAL TO picButterfly1:

This works:

def negative(picButterfly1):
   for px in getPixels(picButterfly1):
      red=getRed(px)
      green=getGreen(px)
      blue=getBlue(px)
      negColor=makeColor(255-red, 255-green, 255-blue)
      setColor(px,negColor)

file = pickAFile()
picture = makePicture(file)

negative(picture)
show(picture)

Also look at:

  • This (for negating images).
  • This (for drawing lines) - or any of those.

Your variables "red", "blue", and "green" already have a function in it, change it to a single character or just a capital letter like "Red". I know this was posted in 2014 but I'll leave a comment for the future.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top