C Program To Convert (R, G, B) To (C, M, Y, K) Color Format

preview_player
Показать описание

In digital world colors are specified in Red-Green-Blue (RGB) format, with values of R, G, B varying on an integer scale from 0 to 255. In print publishing the colors are mentioned in Cyan-Magenta-Yellow-Black (CMYK) format, with values of C, M, Y and K varying on a real scale from 0.0 to 1.0. Write a C program that converts RGB color to CMYK color as per the following formulae:

White = Max(Red/255, Green/255, Blue/255);
Cyan = (White – Red/255) / White;
Magenta = (White – Green/255) / White;
Yellow = ( White – Blue/255) / White;
Black = 1-White

Note that if the RGB values are all 0, then the CMY values are all 0 and the K value is 1.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

RGB values are int why did u take float pls tell me

sumukhasureban
Автор

What if Both Green and Blue are Greater than Red then what will be maximum

tejasdonadkar