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
a third important logical element is the inverter. an inverter does pretty much what it says. if the input is 0, the output is 1
Mrrafil [7]

Answer:

xy225.252 <  \geqslant  > . \times 5 \times . =  {?}^{2}

7 0
3 years ago
Recall the insertion-sort-like algorithm in Problem 4 from Homework 2, where you know that certain pairs of contiguous items in
amid [387]

Answer:

See the attached picture.

Explanation:

See the attached picture.

7 0
3 years ago
Optimal page replacement ______.A. is the page-replacement algorithm most often implementedB. is used mostly for comparison with
deff fn [24]

Answer:

A. Is the page-replacement algorithm most often implemented.

Explanation:

This algorithm is used when a page that is not present in memory is called, leading to the Operating System to replace one of the existing pages with the needed one. There are different replacing algorithms in order to decide which page will be replaced.

This algorithm is implemented to reduce the number of failures and provide a better funcionality and speed the process by discarding pages that won't be used for a long period of time.

8 0
3 years ago
The view that perceptual processes take place over time and can be thought of in terms of a software/hardware metaphor is known
Wittaler [7]

The view that perpetual processes can be thought of in terms of a software/hardware metaphor is known as the: information processing view.

<h3>What is the Information Processing View?</h3>

Information processing view is explained by the cognitive theory to explain how the brain encodes information and how information are filtered from what we pay attention to in a particular moment. This also determines what is stored in the short-term or in our long-term memory.

Therefore, the view that perpetual processes can be thought of in terms of a software/hardware metaphor is known as the: information processing view.

Learn more about the information processing view on:

brainly.com/question/24863946

3 0
2 years ago
To create a formula in______, you would first click in one of the cells​
Pavlova-9 [17]

Answer:excel

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • What information is not typically included in an e-mail header?​?
    15·1 answer
  • Which part of the faucet is the aerator?
    13·1 answer
  • Adult learners understand a topic best by doing it. It gives them both new skills and confidence in their ability to carryout th
    6·1 answer
  • The United States is the only country in the world in which organs and tissue transplants are performed. True or False?
    8·1 answer
  • ____________ are collected from several entities at the same point in time.
    13·1 answer
  • A technician has been asked to upgrade a processor and needs to do some research. The computer is just a couple of years old. Wh
    13·1 answer
  • What feature sets Macs apart from other operating systems?
    5·1 answer
  • How would you reduce or minimize the size of a "file"?
    5·1 answer
  • What is one disadvantage of transmitting personal data using digital signals?
    15·2 answers
  • Stroke weight - ____ of the line around a shape or size of the point
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!