RGB color space to CMYK color space
For color image, each image pixel can be represented by content ofRed, Green, Blue
since any color can be created by using specific intensity ofred, green, and blue light. However, the RGB color space is notideal for other media. Printers use the CMY (Cyan/Magenta/Yellow)color space, as ink absorbs some light while reflecting others tocreate colors. Since Black ink is inexpensive, printers extend theCMY color space to CMYK, where K is black. The usage of black inkis maximized by factoring out black from the C, M, and Y values.The conversion from RGB to CMYK color space is given as![Problem 1 (30 points) RGB color space to CMYK color space For color image, each image pixel can be represented by content of](https://media.cheggcdn.com/media/f30/f30b437b-6d41-4a11-99de-8f5e95d7dc44/phpinh7Ld)
Problem 1 (30 points) RGB color space to CMYK color space For color image, each image pixel can be represented by content of Red, Green, Blue since any color can be created by using specific intensity of red, green, and blue light. However, the RGB color space is not ideal for other media. Printers use the CMY (Cyan/Magenta/Yellow) color space, as ink absorbs some light while reflecting others to create colors. Since Black ink is inexpensive, printers extend the CMY color space to CMYK, where K is black. The usage of black ink is maximized by factoring out black from the C, M, and Y values. The conversion from RGB to CMYK color space is given as C1 = 255-R M1 = 255-G Y1 = 255-B K = Minimum (C1, M1, Y1) C = C1-K M = M1-K Y = Y1-K For example, if R = 10, G = 20, B = 30, then C1 = 245, M1 = 235, Y1 = 225, K = minimum(245,235,225) = 225. Then C = 245 - 225 = 20, M = 235-225 = 10, Y = 223-225 = 0. Write an interactive C program that can perform a conversion from RGB to CMYK color space. Your code needs to make sure that a user will enter only integer between 0 and 255 for each value of red, green, blue. See sample code execution. Your code MUST use the given two structure to declare variables of type RGB and CMYK, respective. typedef struct RBG_${ int red, green, blue; } RGB; typedef struct CMYK_${ int cyan; int magenta; int yellow; int black; CMYK; //the function converts from RGB to CMYK CMYK conversion_to_CMYK(RGB pixel_color); If your code does not use the given two structures, 10 points will be deducted. If you code does not use the given user-defined function, 10 points will be deducted. Sample Code Execution: Bold indicates information entered by the user Enter content of Red Green Blue (0-255):-103 Enter content of Red Green Blue (0-255): 0 260 4 Enter content of Red Green Blue (0-255): 0 0 256 Enter content of Red Green Blue (0-255): 260 270 280 Enter content of Red Green Blue (0-255): 0 0 0 Cyan: 0, Magenta = 0, Yellow = 0, Black = 255 Continue (n for no)? y Enter content of Red Green Blue (0-255): 10 20 30 Cyan: 20, Magenta = 10, Yellow = 0, Black = 225 Continue (n for no)? x Enter content of Red Green Blue (0-255): 255 255 255 Cyan: 0, Magenta = 0, Yellow = 0, Black = 0 Continue (n for no)? a Enter content of Red Green Blue (0-255): 30 40 50 Cyan: 20, Magenta = 10, Yellow = 0, Black = 205 Continue (n for no)? g Enter content of Red Green Blue (0-255): 255 0 0 Cyan: 0, Magenta = 255, Yellow = 255, Black = 0 Continue (n for no)? a Enter content of Red Green Blue (0-255): 255 0 255 Cyan: 0, Magenta = 255, Yellow = 0, Black = 0 Continue (n for no)? h Enter content of Red Green Blue (0-255): 175 35 280 Enter content of Red Green Blue (0-255): 175 350 Cyan: 0, Magenta = 140, Yellow = 175, Black = 80 Continue in for no)?n