CSC111 JES Program for Image Processing

From dftwiki3
Revision as of 09:10, 10 March 2014 by Thiebaut (talk | contribs)
Jump to: navigation, search

--D. Thiebaut (talk) 10:08, 10 March 2014 (EDT)


Skeleton Program to Get Started With


# JES Picture processing
# D. Thiebaut
# A demo of some of the functions available in JES for manipulating 
# the pixels of an image.


# the image we are playing with
image = None

# changeColor( image ).
# Changes the amount of red, green and blue that is in an image
def changeColor( image ):
  for x in range(0,getWidth(image)):
    for y in range(0,getHeight(image)):
        pixel = getPixel (image, x, y)
        red   = getRed(pixel)
        green = getGreen(pixel)
        blue  = getBlue(pixel)
  
        # the line below replaces the pixel with its original color.  Change
        # the amount of red, green and blue to see some change in the colors
        newColor = makeColor( red, green, blue )
        setColor( pixel, newColor )
  return image

# ==================================================================  
#                             MAIN PROGRAM
# ==================================================================  
file = pickAFile()
image = makePicture( file ) 
show( image )
  
#image = changeColor( image )
#repaint( image )



...