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
You have a 20-bit network part and a 4-bit subnet part. How many hosts can you have per subnet?
Ymorist [56]

Answer:

tiddies

Explanation:

sukk

3 0
3 years ago
"Switches break up _______________ domains and routers break up _____________ domains."
mel-nik [20]

Answer:

Switches break up collision domains and routers break up broadcast domains.

Explanation:

  • Collision domain depicts the part within a network where a collision can happen.
  • Collision occurs when two hosts transmit data packet at the same time within a network. Theses packets collide and the hosts have to resend the data after some time.
  • Too many collisions can result in slow traffic speed and can effect network performance.
  • So switches break up collision domains between the devices on a network and each port in a switch depicts a collision domain. This reduces the chance of packet collisions between the devices or hosts.
  • When data is to be sent to a host, the switch keeps that data frame and waits for availability of the destination host before sending the data frame.
  • Moreover full duplex switch mode there is not chance of collision as the transmitting path on one host is the receiving path on other host.
  • Broadcast domain contains all the hosts that can reach each other at the Data Link layer via broadcast.
  • Routers break up broadcast domains as routers contain separate broadcast domains for each interface.
  • Routers do not forward broadcasts from one broadcast domain to other and drop the packet when they detect a broadcast address.
4 0
3 years ago
PLEASE HELP I WILL MARK BRAINIST!!!!!!!!!<br><br><br> What is a rolodex?
Mariana [72]
Its a gadget that helps organize cards/ a rotating file device.
5 0
3 years ago
Which line of code will create an instance of the pet class?
Sunny_sXe [5.5K]

Answer:

myPetA = pet(self, 'dog', 'Spot')

Explanation:

I mite be wrong

8 0
2 years ago
Read 2 more answers
1) Create a recursive program that prompts the user for a nonnegative integer N and outputs. a) Sum [N] b) BiPower [N] c) TimesF
Georgia [21]

Answer:

//Code is created using java

import java.util.*;

// returns the sum

public int sum(int N)

{

if(N==1)

return (1);

else

return N+sum(N-1);

}

// code to return the Bipower ouput

public int BiPower(int N)

{

if(N==1)

return (2);

else

return 2*BiPower(N-1);

}

// Code to return TimesFive output

public int TimesFive(int N)

{

if(N==1)

return 5;

else

return 5 + timesFive(N-1);

}

public static void main(String args[])

   {

//Prompts the user to enter a nonnegative integer

       int N  = Integer.parseInt.(console.readLine("Enter a nonnegative integer:  "));

//Outputs the sum, Bipower and TimesFive

       System.out.println(sum(n));

       System.out.println(BiPower(n));  

       System.out.println(TimesFive(n));

   }

}

4 0
3 years ago
Other questions:
  • Discuss what they need to consider if they wish to use their devices when they are away from home?
    6·1 answer
  • Your friend sees an error message during Windows startup about a corrupted bootmgr file. He has another computer with a matching
    12·1 answer
  • This is the thing that I don't understand why did they banned private chat like there are long-distance relationships, and frien
    13·2 answers
  • ____________ hackers break into systems legally for non-malicious reasons such as to test system security vulnerabilities
    7·2 answers
  • How does netbios identify a computer system on the network?
    13·1 answer
  • Lets say if my computer shut down every 10 minutes. What can you do to solve the problem. Hint: Use these word in you answer: ha
    10·2 answers
  • Consider the following code.
    7·2 answers
  • What is phishing?
    14·1 answer
  • Helppppppppppppppppppppppppppppppppp
    13·2 answers
  • Discuss the ways you can perform to prevent your computer/device and its data/contents from being stolen. Define two-facto authe
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!