Download JES Tool JES: Jython Environment for Students Python development tool developed by Georgia Tech Download and install JES at C:/100 https://code.google.com/p/mediacomp-jes/downloads/list Select Jes-4-2-1-windows.zip
Unzip JES Tool Right-click on the zip file in Downloads folder, select ‘Extract All’
Select unzip folder Select C:\100 to unzip
Download media files Under C:\100, you should have Create a new folder pics under C:\100 Download www.cs.uml.edu/~kim/100/pics.zip Save into C:\100\pics Right click and select 7-zip &‘Extract here.” Under C:\100, you should have C:\100\jes-4-2-1-windows C:\100\pics (folder) Make a desktop shortcut to jes-4-2-1-windows\JES.exe (Python head icon)
Python/JES JES IDE (Integrated Development Environment) Incorporates editing environment Program pane Command pane Watcher button to view debugging
Picture Functions in JES Identify a picture and NAME it Determine width and height of the picture Do operation on a pixel, propagating the same operation over the entire picture
1. How to access a Picture in JES ? Select a picture file For example, myFile = pickAFile() WARNING: picture file (eiffel.jpg) is NOT a picture A picture file HAS TO BE converted to a picture object myPic = makePicture(myFile) Or, myPic = makePicture(pickAFile())
2. Get Picture Dimension pWid = myPic.getWidth() pHgt = myPic.getHeight()
3. Image Processing Negative B/WReduce Red Sunset Posterize Redeye Sepia-tone Mirror Symmetry Background substitution – chromakey Edge Detection Rotate Scale up or down a picture
Access a Pixel in a picture pixel = picture.getPixel(x,y) Given a pixel px, Get individual colors: px.getRed(), px. getGreen(), px.getBlue() Set new colors: px.setRed(255), … Work with a color in (R,G,B) myG = makeColor(0,255,0) px.setColor(myG) myColor = px.getColor() myColor = pickAColor()
Example >>> pic = makePicture(pickAFile()) >>> pix = pic.getPixel(1,1) >>> print pix Pixel, color=color r=168 g=131 b=105 # get/set individual color values >>> print pix.getRed() 168 >>> pix.setRed(255) 255 >>> color=pix.getColor() >>> print color color r=255 g=131 b=105 >>> pix.setColor(color)
LAB_1024 Pick any picture Draw a horizontal line of 10 pixels from (20,50) in the picture