By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,728 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,728 IT Pros & Developers. It's quick & easy.

Applying tint to photo

P: 1
my question is how can i apply an orange tint intensity of 40 to a photo

i tried to do part of it but am confused after that
Expand|Select|Wrap|Line Numbers
  1. file = pickAFile()
  2. pic = makePicture(file)
  3. w = getWidth(pic)
  4. h = getHeight(pic)
  5. intensity = requestIntegerInRange("What intensity?",1,99)
  6. tintColor = pickAColor()
  7. samplePicture = makeEmptyPicture(1,1)
  8. samplePixel = getPixel (samplePicture,0,0)
  9.  
  10. setColor (samplePixel,tintColor)
  11. tintRed = getRed(samplePixel)
  12. #printNow (tintRed)
  13. tintGreen = getGreen(samplePixel)
  14. #printNow (tintGreen)
  15. tintBlue = getBlue(samplePixel)
  16. #printNow (tintBlue)
  17.  
  18. show (pic)
thx in advance
Jun 12 '13 #1
Share this Question
Share on Google+
1 Reply

kudos
Expert 100+
P: 127
(I am not close to my python interpreter, so I don't get to test it....)

But isn't orange, 255,160,0 i RGB colors? I assume 40 tint, means 40% orange, so what would happen if you added the following to each pixel:

R = (R + (255*0.4))%255
G = (G + (160*0.4))%255
B = (B + (0*0.4))%255

Would that give you a orange tint?
Jun 12 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.