-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathImageBuster.java
More file actions
49 lines (44 loc) · 1.72 KB
/
ImageBuster.java
File metadata and controls
49 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.awt.Color;
/**
* This is the starter files for the DistortedImage assignment.
* On a given input image, decode the image and save it as a new one.
* The secret image you need to decode is in img folder: secret.png.
*
* How-to:
* The Green and Blue components of the input image are random noise.
* To decode the input image, get rid of the Green and Blue components.
* Then, multiply the Red component of pixels by 10 and save the image.
*
* Helpful notes:
* SimpleImage class encapsulates the complexity of working with
* individual pixels in the image. It supports only jpg and png.
*
* To work with the SimpleImage, look into its code.
* 1. To load an image using the following command:
* SimpleImage si = new SimpleImage("path_to_your_input_file.png");
* 2. To access the height and width:
* si.height() and si.width(), where si is a SimpleImage object
* 3. To get the color of a pixel:
* Color c = si.get(x, y); // where x and y are the coordinates
* // of the pixel on the image
* Read about the Color class in Java documentation if needed.
* 4. To get Red, Green, or Blue components from the Color object:
* int red = c.getRed(); // where c is a Color object
* int green = c.getGreen();
* int blue = c.getBlue();
* 5. To change the color of a pixel on the SimpleImage:
* si.set(x, y, newColor); // where x and y are the coordinates;
* // newColor is a Color object
* 6. To save a SimpleImage object si:
* si.save("path_to_the_new_image.png");
*
* @author Insert your name here
*
*/
public class ImageBuster {
public static void main(String[] args) {
/**
* Insert your code here
*/
}
}