Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CMYK to RGB color matching. Write a program CMYKtoRGB that reads in four command line inputs C, M, Y, and K between 0 and 1,

CMYK to RGB color matching. Write a program CMYKtoRGB that reads in four command line inputs C, M, Y, and K between 0 and 1, and prints the corresponding RGB parameters. Devise the appropriate formula by "inverting" the RGB to CMYK conversion formula. This is for Java. Using Dr.Java. Here is my code for RGB to CMYK and it wants me to invert the formula for CMYK to RGB.

public class Ex_1_2_32 { public static void main(String[] args) { double r = Double.parseDouble(args[0]); double g = Double.parseDouble(args[1]); double b = Double.parseDouble(args[2]); double w = Math.max(r / 255, Math.max(g / 255, b / 255)); double c = (w - (r / 255)) / w; double m = (w - (g / 255)) / w; double y = (w - (b / 255)) / w; double k = 1 - w; System.out.println("C = " + c); System.out.println("M = " + m); System.out.println("Y = " + y); System.out.println("K = " + k); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions