1 / 28

Programing in JES ( Jython )

Programing in JES ( Jython ). Kayla Dean & Patrick Baker. Original Picture. Sunset. def sunset(filename): filename = makePicture ( pickAFile ()) explore(filename) for p in getPixels (filename): value = getBlue (p) setBlue (p, value * 0.7) value = getGreen (p)

bono
Download Presentation

Programing in JES ( Jython )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programing in JES(Jython) Kayla Dean & Patrick Baker

  2. Original Picture

  3. Sunset def sunset(filename): filename = makePicture(pickAFile()) explore(filename) for p in getPixels(filename): value = getBlue(p) setBlue(p, value * 0.7) value = getGreen(p) setGreen(p, value * 0.7) explore(filename)

  4. Sunset Pict

  5. Grayscale def grayscale(filename): filename = makePicture(pickAFile()) explore(filename) for p in getPixels(filename): sum = getRed(p) + getGreen(p) + getBlue(p) intensity = sum / 3 setColor(p, makeColor(intensity, intensity, intensity)) explore(filename)

  6. Grayscale Pict

  7. Mirror Vertical def mirrorVertical(filename): filename = makePicture(pickAFile()) explore(filename) mirrorPoint=getWidth(filename)/2 width=getWidth(filename) for y in range(0, getHeight(filename)): for x in range(0, mirrorPoint ): leftPixel=getPixel (filename, x, y) rightPixel=getPixel (filename, width-x-1,y) color=getColor(leftPixel) setColor(rightPixel ,color) explore(filename)

  8. Mirror Vertical Pict

  9. Mirror Horizontal def mirrorHorizontal(filename): filename = makePicture(pickAFile()) explore(filename) mirrorPoint=getHeight(filename)/2 height=getHeight(filename) for x in range(0, getWidth(filename)): for y in range(0, mirrorPoint ): topPixel=getPixel (filename, x, y) bottomPixel=getPixel(filename, x,height-y-1) color=getColor(topPixel) setColor(bottomPixel ,color) explore(filename)

  10. Mirror Horizontal Pict

  11. Line Detect def lineDetect(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): newRed = getRed(p)*0.229 newGreen = getGreen(p)*0.587 newBlue = getBlue(p)*0.114 luminance = newRed+newGreen+newBlue setColor(p,makeColor(luminance,luminance,luminance)) orig = (filename) makeBw = (filename) sketchLine = getWidth(orig)/2 for x in range(0,sketchLine): for y in range(0,getHeight(orig)-1): here=getPixel(makeBw,x,y) down=getPixel(orig,x,y+1) right=getPixel(orig,x+1,y) hereL=(getRed(here)+getGreen(here)+getBlue(here))/3 downL=(getRed(down)+getGreen(down)+getBlue(down))/3 rightL=(getRed(right)+getGreen(right)+getBlue(right))/3 if abs(hereL-downL)>=10 and abs(hereL-rightL)>=10: setColor(here,black) if abs(hereL-downL)<=10 and abs(hereL-rightL)<=10: setColor(here,white) show(makeBw) return makeBw

  12. Line Detect Pict

  13. Negate Blue def negateblue(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): setBlue(p,0) show(filename)

  14. Negate Blue Pict

  15. Negative def negative(filename): filename = makePicture(pickAFile()) for px in getPixels(filename): red = getRed(px) green = getGreen(px) blue = getBlue(px) negColor = makeColor( 255-red, 255-green, 255-blue) setColor(px, negColor) explore(filename)

  16. Negative Pict

  17. Negate Green def negategreen(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): setGreen(p,0) show(filename)

  18. Negate Green Pict

  19. Negate Red def negatered(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): setRed(p,0) show(filename)

  20. Negate Red Pict

  21. Make Green def green(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): setRed(p,0) setBlue(p,0) show(filename)

  22. Make Green Pict

  23. Make Red def red(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): setGreen(p,0) setBlue(p,0) show(filename)

  24. Make Red Pict

  25. Make Blue def blue(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): setRed(p,0) setGreen(p,0) show(filename)

  26. Make Blue Pict

  27. Other Codes def filename(): filename=makePicture(pickAFile()) def sketchline(): sketchline = getWidth(filename)/2

  28. Source • http://www.clarkvision.com/galleries/gallery.all/web/lion.cub.c02.11.2005.jz3f4256.b-600.html • Site for Original Picture.

More Related