Mixed-Up Code ExercisesΒΆ
Create a function removeGreen(img)
that sets the green in all pixels in image img
to 0.
Write a function removeGreen(img)
that sets the green in all pixels in image img
to 0.
Create a function changeColors(img)
that sets the red in all pixels equal to the blue value in the image img
. Then, it sets the green and blue in all pixels to 255.
Write a function changeColors(img)
that sets the red in all pixels equal to the blue value in the image img
. Then, it sets the green and blue in all pixels to 255.
Create a function reduceGreen(img)
that reduces the green in all pixels by 75% in image img
.
Write a function reduceGreen(img)
that reduces the green in all pixels by 75% in image img
.
Create a function changeRed(img)
that sets all red values equal to 1.5x the blue value in the image img
.
Write a function changeRed
that sets all red values equal to 1.5x the blue value in the image img
.
Create a function modifyColors(img)
that decreases the red to 60% of its original value, increases the blue by 60% of its original value, and sets the green to 0 in the image img
.
Write a function modifyColors(img)
that decreases the red to 60% of its original value, increases the blue by 60% of its original value, and sets the green to 0 in the image img
.
Create a function imageToWhite(img)
that makes the image img
completely white.
Write a function imageToWhite(img)
that makes the image img
completely white.
Create a function alternatingRed(img)
that sets the red of every other pixel to 0 in the image img
.
Write a function alternatingRed(img)
that sets the red of every other pixel to 0 in the image img
.
Create a function changeQuadrantColors(img)
that only changes the color of the pixels in the bottom left quadrant of the image img
.
The code should set the red value to the original blue value, the green value to the original red value, and the blue value to the original green value.
Write a function changeQuadrantColors(img)
that only changes the color of the pixels in the bottom left quadrant of the image img
.
The code should set the red value to the original blue value, the green value to the original red value, and the blue value to the original green value.
Create a function copyRightSide(img)
that copies the right side of the image onto the left side in the image img
.
Write a function copyRightSide(img)
that copies the right side of the image onto the left side in the image img
.
Create a function copyTopQuarter(img)
that copies the pixels from the top quarter of the y-axis to the bottom quarter of the y-axis in the image img
.
Write a function copyTopQuarter(img)
that copies the pixels from the top quarter of the y-axis to the bottom quarter of the y-axis in the image img
.