WEBVTT

00:00:01.040 --> 00:00:04.650
hi in this video we'll be learning about

00:00:04.650 --> 00:00:07.730
how we can make pixels with color so

00:00:07.730 --> 00:00:10.410
we've seen how images are made up of

00:00:10.410 --> 00:00:12.900
pixels pixels are the tiny little

00:00:12.900 --> 00:00:14.610
squares each of which have their own

00:00:14.610 --> 00:00:18.090
color that come together in a grid such

00:00:18.090 --> 00:00:19.529
that when viewed from a distance the

00:00:19.529 --> 00:00:21.270
image looks smooth and it looks like it

00:00:21.270 --> 00:00:23.460
has curves and lines but it's all made

00:00:23.460 --> 00:00:25.199
up of those tiny little pixels that are

00:00:25.199 --> 00:00:28.949
tiny squares with one constant color so

00:00:28.949 --> 00:00:30.960
to make an image digital to represent an

00:00:30.960 --> 00:00:33.540
image with numbers an image can really

00:00:33.540 --> 00:00:35.370
just be represented as a grid of values

00:00:35.370 --> 00:00:38.160
where each value encodes the color at

00:00:38.160 --> 00:00:39.960
that position in the image it encodes

00:00:39.960 --> 00:00:42.780
the color for that pixel so we've seen

00:00:42.780 --> 00:00:45.629
the very simple system of just one bit

00:00:45.629 --> 00:00:48.300
per pixel zero means black and one means

00:00:48.300 --> 00:00:50.879
white and this is great when we want to

00:00:50.879 --> 00:00:53.820
make simple black and white images but

00:00:53.820 --> 00:00:56.610
what about color RGB encoding scheme

00:00:56.610 --> 00:00:59.219
allows us to encode colors as numeric

00:00:59.219 --> 00:01:01.469
data and the way it does this is it

00:01:01.469 --> 00:01:04.470
defines the amount of red green and blue

00:01:04.470 --> 00:01:07.229
light in a pixel this is where RGB comes

00:01:07.229 --> 00:01:10.140
from red green blue the idea here is

00:01:10.140 --> 00:01:12.330
that any color can be created by

00:01:12.330 --> 00:01:15.119
combining red green and blue light at

00:01:15.119 --> 00:01:17.220
varying intensities the way this works

00:01:17.220 --> 00:01:19.920
is each pixel gets three values one

00:01:19.920 --> 00:01:21.750
value for red one value for green and

00:01:21.750 --> 00:01:23.880
one value for blue and putting those

00:01:23.880 --> 00:01:25.950
three values together makes a color so

00:01:25.950 --> 00:01:28.439
if we have 0 for every channel then we

00:01:28.439 --> 00:01:31.020
have no lights we have a black pixel if

00:01:31.020 --> 00:01:32.729
we have some mix in between say we had

00:01:32.729 --> 00:01:36.900
156 red 54 green and 255 blue that gives

00:01:36.900 --> 00:01:39.509
us purple and if we have them all all

00:01:39.509 --> 00:01:41.759
the way up if we have 255 for every

00:01:41.759 --> 00:01:43.770
single channel that's how we get white

00:01:43.770 --> 00:01:45.899
we max out each color to its max

00:01:45.899 --> 00:01:49.710
intensity and we get a white pixel so

00:01:49.710 --> 00:01:52.350
each color channel gets its own value in

00:01:52.350 --> 00:01:55.439
the range from 0 to 255 this is the

00:01:55.439 --> 00:01:57.659
minimum and maximum value for any pixel

00:01:57.659 --> 00:02:00.149
Channel RGB let's explore this in the

00:02:00.149 --> 00:02:02.759
editor so here we're back in our bit

00:02:02.759 --> 00:02:04.890
interpreter and now we're interpreting

00:02:04.890 --> 00:02:07.530
bits as color pixels as opposed to black

00:02:07.530 --> 00:02:09.899
and white pixels we can still go back to

00:02:09.899 --> 00:02:11.069
interpreting as black and white if we

00:02:11.069 --> 00:02:12.810
want but this is going to completely

00:02:12.810 --> 00:02:13.740
change the scheme

00:02:13.740 --> 00:02:15.690
right now these first eight bits encode

00:02:15.690 --> 00:02:17.310
the entire picture because we only have

00:02:17.310 --> 00:02:19.800
one bit per color so I can change this

00:02:19.800 --> 00:02:21.420
first one to a one and they'll end up

00:02:21.420 --> 00:02:24.690
turning white but if we want to

00:02:24.690 --> 00:02:26.730
interpret as color it takes a lot more

00:02:26.730 --> 00:02:28.830
bits to represent a single color so here

00:02:28.830 --> 00:02:31.890
these first 24 bits are encoding black

00:02:31.890 --> 00:02:35.040
this next every channel is on we have

00:02:35.040 --> 00:02:37.440
all ones for red all ones for green all

00:02:37.440 --> 00:02:39.110
ones for blue so that's gonna be white

00:02:39.110 --> 00:02:41.730
here only red is on that's gonna be red

00:02:41.730 --> 00:02:43.650
and here only green is on this is going

00:02:43.650 --> 00:02:46.440
to be green if we ever want to figure

00:02:46.440 --> 00:02:48.240
out how to make a color that we don't

00:02:48.240 --> 00:02:49.920
know how to make using bits we can use

00:02:49.920 --> 00:02:51.660
this color picker over here so just

00:02:51.660 --> 00:02:53.880
dragging this around you can see you can

00:02:53.880 --> 00:02:55.740
see what string of bits maps to what

00:02:55.740 --> 00:02:58.500
color let me drag this up and down to

00:02:58.500 --> 00:02:59.760
get various colors and drag this around

00:02:59.760 --> 00:03:03.060
to get various brightnesses so let's try

00:03:03.060 --> 00:03:05.730
to finish out our image by trying to

00:03:05.730 --> 00:03:07.110
create every color we can possibly make

00:03:07.110 --> 00:03:09.630
by turning channels all the way on so

00:03:09.630 --> 00:03:11.700
we've made red and green have to make

00:03:11.700 --> 00:03:14.910
blue well blue is going to have the red

00:03:14.910 --> 00:03:16.350
and green channels turned all the way

00:03:16.350 --> 00:03:19.500
off and the blue channel turned all the

00:03:19.500 --> 00:03:22.620
way on 255 the maximum value for blue so

00:03:22.620 --> 00:03:26.130
we want a zero for red a zero for green

00:03:26.130 --> 00:03:30.050
and a 255 for blue so that's eight once

00:03:30.050 --> 00:03:32.700
awesome so we made blue we can also

00:03:32.700 --> 00:03:34.920
switch from binary to hexadecimal and

00:03:34.920 --> 00:03:35.910
this is going to make typing a lot

00:03:35.910 --> 00:03:38.280
easier for us so here instead of eight

00:03:38.280 --> 00:03:40.230
bits per color channel we have two

00:03:40.230 --> 00:03:42.540
hexadecimal digits per color channel so

00:03:42.540 --> 00:03:45.180
these first two encode red second to

00:03:45.180 --> 00:03:47.550
encode green last to encode blue so

00:03:47.550 --> 00:03:50.010
that's why this pixel is red this pixels

00:03:50.010 --> 00:03:52.620
green this pixels blue so we've tried

00:03:52.620 --> 00:03:54.720
combining red and green what if we

00:03:54.720 --> 00:03:56.970
combine green and blue what color is

00:03:56.970 --> 00:03:59.640
that going to be will turn red off green

00:03:59.640 --> 00:04:02.880
on blue on so that made cyan and that

00:04:02.880 --> 00:04:04.260
makes sense here we see right in between

00:04:04.260 --> 00:04:06.630
green and blue we have cyan alright now

00:04:06.630 --> 00:04:07.340
it's your turn

00:04:07.340 --> 00:04:09.689
[Music]
