PIC - Picking a Color (Lesson)
Picking a Color
Introduction
For the next part of the lab you will use several files from the pixLab folder. You will get to explore the colors that make up pictures and start to learn different ways that images can be manipulated. Be sure that you have downloaded the pixLab folder to your computer and extracted the files. If you have any trouble compiling the java files, contact your teacher for help. You will need the files to successfully compile before moving forward with the lab.
Run the main method in ColorChooser.java. This will pop up a window asking you to pick a color. Click on the RGB tab and move the sliders to make different colors.
When you click the OK button, the red, green, and blue values for the color you picked will be displayed.
Java represents color using the java.awt.Color class.
Notice the import statement at the top of the Color class.
Exploring Pictures
Open PictureExplorer.java, compile and run.
A picture of a beach should load from a file. Check to make sure the images are in the proper folder, particularly if the beach pic does not open.
A copy of the picture is made to make it easier to explore a picture both before and after any changes. We are viewing the picture in the explorer tool which allows us to click on the picture and get information, such as location and color of each pixel.
Click any location in the picture and it will display the row index, column index, and red, green, and blue values for that location. The location will be highlighted with yellow crosshairs. You can click on the arrow keys or even type in values and hit the enter button to update the display. You can also use the menu to change the zoom level.
The “beach.jpg” file is in the images folder. A JPEG file is one that follows an international standard for storing picture data using lossy compression. Lossy compression means that the amount of data that is stored is much smaller than the available data, but the part that is not stored is data we won’t miss.
Color Class Review
Click below to begin the Color Class review.
Creating and Exploring Other Pictures Review Activity
Click below to begin the review activity.
IMAGES CREATED BY GAVS