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
When reading words using a Scanner object's next method, _________. a. any characters at the beginning of the input that are con
zavuch27 [327]

Answer:

The answer is "Option d"

Explanation:

The scanner method is the full token of the process, that finds and returns. It is token, which is followed by both the inputs meeting and the guideline template. This method can block, even though the former instance of hasNext() is true while waiting for input, and wrong choices can be described as follows:

  • In option a, It is incorrect because the character at the beginning can't be considered.
  • In option b, It is wrong because the characters are known as the word in which blank space not a part of the word.
  • In option c, It is wrong because in this input before the call is not the method.
3 0
3 years ago
When choosing a new computer to buy, you need to be aware of what operating it uses.
Pavlova-9 [17]

Answer: Size & Form-Factor, Screen Quality,Keyboard quality,CPU, RAM, Storage,Battery Life, USB 3.0, Biometric Security,Build quality.

Explanation:

1 - 7 are the most important for laptops and for desktops 1,3,4,5and 6.

Hope this helped!

8 0
3 years ago
Write a program to calculate and return total surface area of a box using FUNCTION _END FUNCTION.​
Andrei [34K]

Answer:

def funct1():

   h=int(input("Enter height of the box"))

   w=int(input("Enter the width of the box"))

   L=int(input("Enter the length of the box"))

   surface_area=2*(h*w + h*L + w*L)

   return surface_area

a=funct1()

print(a)

Explanation:

Please check the answer section.

6 0
3 years ago
You would set a ___________ to prevent users from immediately changing their password several times in one day to return to the
Temka [501]

Answer:

The answer is (B) Maximum password age.

Explanation:

To prevent several changing of passwords by a user in a day, the maximum times a password can be rest within a day is normally set by  the system administrator.

The setting ensures the password is returned to the current settings of the password on the system for the user and prevents unnecessary changing of passwords in a day by user.

6 0
3 years ago
Read 2 more answers
Which phrase best describes a scenario in Excel 2016?
alexira [117]

Answer:

<h2>YEET B </h2>

Explanation:

Sorry

Its B: a type of what-if analysis that allows a user to define multiple variables for multiple functions or formulas

(i think)

3 0
3 years ago
Read 2 more answers
Other questions:
  • What security protocol originally came with 802.11 equipment?
    11·1 answer
  • 1.
    5·2 answers
  • Which of the following statements is NOT true about a mainframe computer?
    14·1 answer
  • How could a system be designed to allow a choice of operating systems from which to boot? What would the bootstrap program need
    14·1 answer
  • Which of the following people was a member of FFA?
    7·1 answer
  • To gain a competitive edge this year, the upper management of a global IT company has decided to focus on customer service, empl
    13·1 answer
  • What is the maximum current that should be allowed in a 5.0w 220 resistor?
    12·1 answer
  • When individuals not involved in the development process are asked to test the game, this is called ________ group testing.
    11·1 answer
  • Of the following online activities, identify the TWO that are most likely to be affected by bandwidth quality
    11·1 answer
  • ________ are the symbolic codes used in assembly language?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!