Write Code Exercises¶
Note
Remember that it can take a bit of time to process all the pixels in a picture! Check for errors below the code if it is taking a long time, but if you don’t see any errors just wait.
A grayscale picture is when the red, green, and blue value of a pixel are all equal to the average of the original pixel value. Write the code to turn the left half of the image gal2.jpg
into gray scale.
A grayscale picture is when the red, green, and blue value of a pixel are all equal to the average of the original pixel value. Create the code to turn the left half of the image gal2.jpg
into gray scale.
Define a procedure to negate an image. You can negate an image by setting each color value to 255 minus the current value. Write code to negate the kitten.jpg
image.
Define a procedure to negate an image. You can negate an image by setting each color value to 255 minus the current value. Create code to negate the kitten3.jpg
image.
Write code that copies the top half of the image kitten.jpg
to the bottom half.
Write code that copies the top half of the image kitten.jpg
to the bottom half.
Write a function to mirror the image swan.jpg
from left to right around a vertical line in the middle of the image. Pass the image to the function. Do the import, create the image, call the function, and show the result.
Create a function to mirror the image swan.jpg
from left to right around a vertical line in the middle of the image. Pass the image to the function. Do the import, create the image, call the function, and show the result.
Write code that flips the image vangogh.jpg
across a horizontal line.
Create code that flips the image vangogh.jpg
across a horizontal line.