将色调应用于照片

我的问题是如何将40的橙色色调强度应用到照片上
我试着做了一部分,但在那之后我感到困惑

选择 | 换行 | 行号
  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

# 回答1


(我离我的Python解释器不太近,所以我没有机会测试它……)
但橙色、255、160、0 i RGB不是颜色吗?我假设40的色调意味着40%的橙色,那么如果将以下内容添加到每个像素上会发生什么:
R=(R+(255*0.4))%255
G=(G+(160*0.4))%255
B=(B+(0*0.4))%255
这会让你染成橙色吗?

标签: python

添加新评论