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
What is the function of a computer screen?
Leni [432]

Hi!

A computer screen is what you are staring at right now!

It displays the output. Behind it are wires and cords.



~CoCo

7 0
3 years ago
The master production schedule for Product A shows a need for 30 units, and Product B shows a need of 25 units. To manufacture a
alexandr1967 [171]

Answer:

the amount of C required is 190 units of C

Explanation:

the amount of C to cover the necessity of product A is

Ca = A units required * number of C units to manufacture a unit of A

Ca = 30 unit of A * 3 units of C/ unit of A =90 units of C

to produce B the same applies

Cb = B units required * number of C units to manufacture a unit of B

Cb = 25 unit of B * 4 units of C/ unit of B =100 units of C

therefore to cover the necessities of A and also B we will need:

total units of C required = units of C to produce A + units of C to produce B

C = Ca + Cb = 90 units of C + 100 units of C = 190 units of C

C= 190 units of C

3 0
3 years ago
Before starting a spreadsheet, it is smarter to plan ahead and think through the design. true or false
Nesterboy [21]
True. THe axis order (horizontal/vertical) for instance, can cause a serious headache to you when organized wrong.
The same goes with functions, it's better to check them mentally/in a piece of paper beforehand.
6 0
3 years ago
Which mark is an indicator of invalid data in a cell?
Snowcat [4.5K]

Answer:

A.) red circle around the value

Explanation:

Just did the Assignment on Edge 2021

Plz click the Thanks button!

<Jayla>

4 0
3 years ago
Difference between a software and a hardware​
laiz [17]

Answer:

soft... intangible hard.... tangible

4 0
3 years ago
Other questions:
  • A(n) _____ of an class is where the services or behaviors of the class is defined. (Points : 6) operation
    6·1 answer
  • What name are input devices, output devices, and auxiliary storage devices collectively known?
    9·1 answer
  • When a process becomes digital, it often becomes cheaper and the workflow becomes simpler. True False
    5·2 answers
  • Optimization Score is made up of over 50 recommendations to optimize Search campaigns.A. TrueB. False
    11·1 answer
  • Help!!! Who is this? Who is it from?
    14·2 answers
  • What is the most likely result of making a plan for life after high school
    14·1 answer
  • Compare and contrast the properties of a centralized and a distributed routing algorithm. give an example of a routing protocol
    15·1 answer
  • You use buttons and commands on the ribbon to tell word what you want to do. true or false
    10·1 answer
  • Consider an application that transmits data at a steady rate (for example, the sender generates an N-bit unit of data every k ti
    5·1 answer
  • Write a program that prompts the user for two numbers then outputs the result of dividing the first number by the second number
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!