1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
erica [24]
4 years ago
6

How to write a program converting RGB to CMYK in python

Computers and Technology
1 answer:
Arisa [49]4 years ago
5 0

rgb_scale = 255

cmyk_scale = 100

def rgb_to_cmyk(r,g,b):

if (r == 0) and (g == 0) and (b == 0):

return 0, 0, 0, cmyk_scale

# rgb [0,255] -> cmy [0,1]

c = 1 - r / float(rgb_scale)

m = 1 - g / float(rgb_scale)

y = 1 - b / float(rgb_scale)

min_cmy = min(c, m, y)

c = (c - min_cmy)

m = (m - min_cmy)

y = (y - min_cmy)

k = min_cmy

return c*cmyk_scale, m*cmyk_scale, y*cmyk_scale, k*cmyk_scale

def cmyk_to_rgb(c,m,y,k):

r = rgb_scale*(1.0-(c+k)/float(cmyk_scale))

g = rgb_scale*(1.0-(m+k)/float(cmyk_scale))

b = rgb_scale*(1.0-(y+k)/float(cmyk_scale))

return r,g,b

You might be interested in
On laptops, wireless cards tend to be attached to which panel?
ELEN [110]

Answer:

LCD panel

Explanation:

Regularly these wireless cards tend to be attached to the LCD panel because the wireless cards have a Wi-Fi antenna to get a better signal.

Regularly the wireless card has two cables, those cables go between the hinges until arrives at the display panel (LCD panel).

There are wireless cards that are connected by the USB port, this is so useful because there are some cards welded in the motherboard.

8 0
4 years ago
Which feature of virtualisation helps increase the IT productivity of a business
PIT_PIT [208]

Answer:

Add, remove, organize and reorder commands on the Quick Access Toolbar. ... The Quick Access Toolbar is a customizable toolbar that contains a set of ... The only way to increase the size of the buttons is to lower the screen resolution you use. ... However, you can Customize the ribbon in Office to personalize the ribbon ...

Explanation:

because

8 0
4 years ago
Ik this isnt an assignment question, but can ya'all friend me? Im lonely ;-; lol
Elan Coil [88]

Answer:hi I’m lonely too

Explanation

:)

4 0
3 years ago
For a parking payment app, what option would MOST likely connect a user to a third party/external gateway?
Alik [6]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

Almost all app that is doing online business integrated third party payment gateway and login/services. But some apps, don't integrate the third party login/signin services such as go ogle or face book login/sign in services.

But in the context of this question, for a parking payment app, upon reservation of parking space, the pay option connects a user to a third party/external gateway. This gateway will accept payment from the user and upon confirmation of payment, the parking space will get reserved.

so the correct option to this question is:

  • Pay

While the other options are incorrect because:

The sign-in option does not connect the user to a third pay/gateway in case if the app has self-registration and sign-in functionality. Rate and Time remaining are features of the app that does not force the user to connect third-party gateway.

3 0
3 years ago
Join array elements to form a string.
Vera_Pavlovna [14]

Answer:

2b2t

Explanation:

2b2t

3 0
3 years ago
Other questions:
  • Which type of statement is used to communicate one’s feelings in a nonconfrontational manner?
    14·1 answer
  • When you try to boot your computer it hangs after post?
    12·1 answer
  • A(n) __________ is a software package that usually consists of a text editor, a compiler or interpreter, and tools to test and d
    14·1 answer
  • A resistor bank is connected to a controller with conductor insulation rated 75 °C. The resistors are not used in conjunction wi
    15·1 answer
  • EASY POINTS
    5·1 answer
  • In Excel, ____ is/are used to place worksheet, column, and row titles on a worksheet.
    11·1 answer
  • People must use telepresence when virtually meeting with a group of co-workers.<br><br> T or F
    8·1 answer
  • Write a html5 code to display 5 friends both an orderd and unordered list .
    12·1 answer
  • Fill in the blanks
    7·1 answer
  • What 3 types of data can be entered in a spreadsheet
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!