Professional Documents
Culture Documents
(x
1
x
2
)
2
+ (y
1
y
2
)
2
The similar measure for two colors (red
1
, green
1
, blue
1
) and (red
2
, green
2
, blue
2
)
is:
(red
1
red
2
)
2
+ (green
1
green
2
)
2
+ (blue
1
blue
2
)
2
You can automatically get the darker or lighter versions of colors with
makeDarker or makeLighter. (Remember that this was easy in HSV, but
not so easy in RGB. These functions do it for you.)
>>> print color
color r=168 g=131 b=105
124 CHAPTER 5. ENCODING AND MANIPULATING PICTURES
>>> print makeDarker(color)
color r=117 g=91 b=73
>>> print color
color r=117 g=91 b=73
You can also make colors from pickAColor, which gives you a variety of
ways of picking a color.
>>> newcolor=pickAColor()
>>> print newcolor
color r=255 g=51 b=51
Once you have a color, you can get lighter or darker versions of the same
color with makeLighter and makeDarker.
>>> print c
color r=10 g=100 b=200
>>> print makeLighter(c)
color r=10 g=100 b=200
>>> print c
color r=14 g=142 b=255
>>> print makeDarker(c)
color r=9 g=99 b=178
>>> print c
color r=9 g=99 b=178
When you have nished manipulating a picture, you can write it out
with writePictureTo.
>>> writePictureTo(picture,"/Users/guzdial/newpicture.jpg")
_
t have a
lot to show you right now. +eol)
outFile.write(I am in my 75th year at Georgia Tech but am
taking CS 1315 so I don