Held: Monday, 1 February 2016
Back to Outline 04 - Computing with Symbols and Numbers.
On to Outline 06 - Transforming Colors.
Summary
We consider the basic use of colors in image making and explore one of
the common digital representations of colors.
Related Pages
Overview
- Color palettes.
- RGB colors.
- Representing RGB colors as integers.
Administrivia
- New Partners! (Take a card to figure out where you are and who your
partner will be.)
- Quiz 1 to be returned tomorrow.
- A lot of snow is scheduled within the next day. Please be careful.
- The Registrar wants me to remind you that Add/Drop deadline is Friday.
- Enjoy caucusing (or watching the Caucuses) tonight!
- Email policies
- When you send me email asking questions, it helps if you title it
something like "HELP" or "QUESTION". (Yes, all caps is okay.)
- I tend to respond to email promptly, but I get a lot of email.
If I haven't responded to email within 24 hours, send me a reminder.
Reminders
- Office hours: MTWF 10-11, Tu 1-2.
- Tutor hours
- Sunday, 3-5 p.m.
- Sunday-Thursday, 7-10 p.m.
- Weekly review sessions:
- Wednesday at 8pm in the CS Commons with Zacharcy
- Thursday at 10am in this room with SamR
- Thursday at 8pm in the CS Commons with Kumar
Questions from Sam
What does round do?
Upcoming Work:
- Readings for Tuesday:
- Assignment 2 due TOMORROW!
at 10:30 p.m.
- Lab Writeup: Problem _
- Send email titled CSC 151 Lab Writeup 5 (Your Names)
- Do not include the underscores.
- Send to CSC151-02-grader@grinnell.edu
- Due before class on Wednesday.
Extra Credit
Academic
- CS Table, Tuesday, Noon, White PDR: Facebook's Walled Internet.
(Readings to be distributed via email.)
- Community Conversations on Race, 7:30 p.m., Tuesday, February 2,
Lazier 3rd Floor Lounge
Peer
- Track and Field Grinnell Invite February 6.
- Swimming February 6 vs. UN and IAState.
Miscellaneous
- Caucus TONIGHT. (Or observe a Caucus.)
Colors
- Many ways to represent colors.
- Goals: Unambiguous, fast to process, compact
- Color names are
- Ambiguous
- Slow to process
- Long
- Whoops!
RGB Colors
- The most common internal representation of colors on computers.
- We think of a color as the combination of three
primaries: red, green, and blue.
- These are the primaries for the so-called additive colors
- You are probably used to the primaries being red, yellow, and blue,
but those are the subtractive colors
- On computers, we represent each component as a number between 0 and 255,
inclusive.
- It turns out that you can shove four numbers, each between 0 and 255,
into the internal representation of an integer.
- So, the red, green, and blue components are three of those numbers.
- What's the forth? In multi-layer images, it's the alpha channel.
- We use
rgb-new to create these colors.
- We use
rgb-red, rgb-green, and
rgb-blue to extract the corresponding components.
Those Weird Color Numbers
- We're representing colors as three integers, each in the range
[0..255].
- Yet when we ask MediaScript for a color, we tend to get a single integer
which is rarely in that range?
- What's going on?
- Well, most computers have different techniques for representing really
small integers (particularly integers in the range 0 to 255, inclusive) and
standard-length integers. We're using the smaller representation,
but shoving three of those into a standard-length integer.
- We use that representation because it makes everything faster.
- Even those of us who designed and implemented that representation
can't read the values presented in that representation.
- The formula for computing those numbers:
- 256256red + 256*green + blue