-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMYKtoRGB.java
More file actions
23 lines (19 loc) · 777 Bytes
/
Copy pathCMYKtoRGB.java
File metadata and controls
23 lines (19 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.lang.Math;
public class CMYKtoRGB {
public static void main (String[] args) {
double cyan = Double.parseDouble(args[0]);
double magenta = Double.parseDouble(args[1]);
double yellow = Double.parseDouble(args[2]);
double black = Double.parseDouble(args[3]);
double white = 1 - black;
double red = Math.round((255 * white * (1 - cyan)));
int r = (int) red;
double green = Math.round((255 * white * (1 - magenta)));
int g = (int) green;
double blue = Math.round((255 * white * (1 - yellow)));
int b = (int) blue;
System.out.println("red = " + r);
System.out.println("green = " + g);
System.out.println("blue = " + b);
}
}