CSC111 JES Program for Image Processing

From dftwiki3
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 )



...