This lab assignment will have you write a function in jython that will either lighten or darken an image by an amount given as a parameter.
In the ACCC Labs that have JES, it can be found by:
makeDarker |
makeDarker(color): color: the color you want to darken returns: the new, darker color Takes a color and returns a slightly darker version of the original color. |
makeLighter |
makeLighter(color): color: the color you want to lighten returns: the new, lighter color Takes a color and returns a slightly lighter version of the original color. |
As it turns out makeDarker() decreases values for each color by 30%, while makeLighter() increases the values for each color by about 40%.
Create a file using JES that will:
If the parameter is a positive number, use makeLighter() to brighten the image. If the parameter is a negative number, use makeDarker() to darken the image. You may also need to call makeLighter() or makeDarker() multiple times based on the actual value of the parameter.
For example, let us assume that modifyBrightness() is called with a parameter of -90. The call in the command area of JES would be:
>>> modifyBrightness (-90) |
For example, let us assume that modifyBrightness() is called with a parameter of 80. The call in the command area of JES would be:
>>> modifyBrightness (80) |
If we are darkening the image, divide the parameter value by 30 and call makeDarker () that number of times for each pixel. If we are lightening the image, divide the parameter value by 40 call makeLighter() that number of time for each pixel. You are to preform integer division, thus ignore any results after the decimal place. For example
Therefore:
This function may call other functions that are built-in to JES or that you have written.