Python/JES JES IDE (Integrated Development Environment) Incorporates editing environment Program pane Command pane Watcher button to view debugging
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
Picture Functions in JES Picture-level: pick a file and make a picture = makePicture(pickAFile()) Pixel-level: pick a pixel in a picture = . getPixel(x.y) Do operation on a pixel, propagating the same operation over the entire picture
Pixel operations Find out what RGB values are .getRed(), . getGreen(), .getBlue() Change to a new colors .setRed(255), .setGreen(0) .setBlue(125) Create a new color in (R,G,B) and set new color = makeColor(0,255,0) .setColor( ) = .getColor() = pickAColor()
2. Get Picture Dimension pWid = myPic.getWidth() pHgt = myPic.getHeight()
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_1026 Pick a file and convert it to a picture file Change colors of 10 pixels at (20,50), (21,50), … (29,50) to reds. Write a function, hrz10(pic), to draw a red horizontal line from (20,50),…,(29,50) in the picture file, pic (or any name). You have to use a ‘for’ loop. Write a function, hrz100(pic,x,y), to draw a red horizontal line from (x,y) for 100 pixels. Write a function, diag(pic,x,y,n), to draw a red diagonal line from (x,y) for n pixels.