Guest User

Untitled

a guest
Jul 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. myFile=pickAFile()
  2. picture=makePicture(myFile)
  3. pictureDup=duplicatePicture(picture)
  4. show(picture)
  5. editImage()
  6.  
  7. def editImage():
  8.  
  9. action=requestString("*** Picture Modifications ***\nm - make monochrome (black-and-white image)\nl - make the image Lighter\nd - make the image Darker\nu - undo\no - reset the picture to the Original\nq - quit")
  10.  
  11.  
  12. if (action == "l"):
  13. for pxl in getPixels(picture):
  14. color = getColor(pxl)
  15. color = makeLighter(color)
  16. setColor(pxl, color)
  17. repaint(picture)
  18. editImage()
  19.  
  20. elif (action == "d"):
  21. for pxl in getPixels(picture):
  22. color = getColor(pxl)
  23. color = makeDarker(color)
  24. setColor(pxl, color)
  25. repaint(picture)
  26. editImage()
  27.  
  28. elif (action == "m"):
  29. for pxl in getPixels(picture):
  30. OGColor = (getRed(pxl)+getGreen(pxl)+getBlue(pxl))/3
  31. setColor(pxl,makeColor(OGColor, OGColor,OGColor))
  32. repaint(picture)
  33. editImage()
  34.  
  35. elif (action== "o"):
  36. show(pictureDup)
  37. editImage()
  38.  
  39. elif (action == "q"):
  40. printNow("quit")
Add Comment
Please, Sign In to add comment