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]
3 years ago
6

How to write a program converting RGB to CMYK in python

Computers and Technology
1 answer:
Arisa [49]3 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
Releasing refrigerant R-12 into the atmosphere is a criminal offense
nevsk [136]
I'm guessing you want a yes or no... I think yes.
8 0
3 years ago
Read 2 more answers
Someone hacked into an employee's computer and erased all of their data. All data for the past three weeks was lost as that was
hichkok12 [17]

WWW/ World Wide Web.

7 0
3 years ago
Select the correct answer.
Pachacha [2.7K]
B) Spreading the news about the incident response plan is not a good idea. If an incident was intentionally caused by a malicious person or group, knowing your response plan gives them information about how to make things worse.
3 0
3 years ago
Jen's house contains the following devices:
poizon [28]

Answer:

Jen's laptop and her daughter's phone, because they are both connected to the router and turned on.

Explanation:

A network comprises of two or more interconnected devices such as computers, routers, switches, smartphones, tablets, etc. These interconnected devices avail users the ability to communicate and share documents with one another over the network.

Additionally, in order for a network to exist or be established, the devices must be turned (powered) on and interconnected either wirelessly or through a cable (wired) connection.

Hence, the computers which are currently networked are Jen's laptop and her daughter's phone, because they are both connected to the router and turned on. A smartphone is considered to be a computer because it receives data as an input and processes the input data into an output (information) that is useful to the end user.

6 0
2 years ago
Older Microsoft disk compression tools, such as DoubleSpace or ____, eliminate only slack disk space between files.
katen-ka-za [31]
I believe the answer is SDelete
6 0
3 years ago
Other questions:
  • ____, developed by xuejia lai and james massey, is a block cipher that operates on 64-bit blocks of plaintext.
    10·1 answer
  • What kind of testing is basically checking whether a game or feature works as expected by the developers?
    10·1 answer
  • What type of function is the IF function?<br> Statistical<br> Logical<br> Financial <br> Text
    5·2 answers
  • The ability of services to grow or shrink based on need is called __________.
    14·1 answer
  • Which one of these are a valid IPv4 address? Check all that apply.
    9·1 answer
  • A bastion host allows the firewall to connect to the internal network and the perimeter network.TrueFalse
    15·1 answer
  • When you call a method with a parameter list, the arguments in the argument list Select one: a. must be coded in the same sequen
    15·1 answer
  • Please help
    15·1 answer
  • What are some positive impacts technology has on the environment?​
    5·2 answers
  • What Pre-Built PC should I get? I don't have a lot of money so I'm looking for cheap options.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!