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
Calculate the resistance of an unknown resistor in a circuit with 30 volts and 6 amps. The formula is R = V/I.
arsen [322]
The answer is 5 ohms
7 0
2 years ago
A plan to budget time for studying and activities is referred to as
krok68 [10]

Answer:

a study schedule.

Explanation:

A plan to budget time for studying and activities is referred to as a study schedule. A study schedule is mostly designed by a student and it comprises of their learning goals and objectives, as well as allocated time to start and  complete.

The main purpose of a study schedule is to avail students the opportunity to maximize their time and improve their ability to study by themselves through an organized schedule for specific subjects, courses or class.

3 0
3 years ago
What was the worlds first coding language
svetoff [14.1K]

Answer:

lol baby

Explanation:

becuase it goated

8 0
2 years ago
Read 2 more answers
Explain why using infrared telescopes would not be useful for stargazing in the city?
Alexeev081 [22]
Because infrared telescopes use infrared aka anything above absolute zero (0 degrees Celsius  or 32 degrees Fahrenheit) meaning that the telescope would not only pick up the stars but also all of the people and lights so on and so forth 

7 0
3 years ago
Microsoft Word cannot be used to create personalized web<br> pages.<br> OTrue<br> False
Georgia [21]

Answer:

False

Explanation:

Because Microsoft can be used to create personalized web

5 0
2 years ago
Other questions:
  • Which option allows you to view slides on the full computer screen?
    11·1 answer
  • ListenListen with ReadSpeakerAn administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on
    9·1 answer
  • A _______ area network is a type of wireless network that works within your immediate surroundings to connect cell phones to hea
    9·2 answers
  • Which of the following software maintenance steps erases gaps caused by deleting files from the hard drive?
    10·1 answer
  • Type the correct answer in each box. Spell all words correctly.
    14·2 answers
  • Brainly is brainly am I correct ​
    11·2 answers
  • What function is used to return the results in column D?
    11·1 answer
  • Fill in the blanks <br>a) an _______________ checks the files on the computer for viruses.​
    6·2 answers
  • Is iphone battery being draned if plugged into car charger when listening to podcasts
    6·1 answer
  • 4. The volume of a sphere is (4.0/3.0)rr3 and the surface area is 4.0rr2, where r is the radius of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!