Image-2 Exercises

For these exercises, write code to manipulate and print the image "x.png". Some basic starter code to load and print the image is provided. Modify and add lines to the starter code as needed to solve each exercise. (This is the last part of homework1.)

1.

Write code to set the pixel at (0, 0) to blue (i.e. blue value is 255, red and green are left at 0).


image-2-ex1
 

 

2.

Write code to set the pixel at (0, 0) to be violet (i.e. red and blue both 255, green left at 0).


image-2-ex2
 

 

3.

Write code to set the pixel at (1, 0) to be pure white.


image-2-ex3
 

 

4.

Write code to set the pixels (0, 0) and (1, 0) to be blue.


image-2-ex4
 

 

Affichages : 2902