# 14.4. Posterizing¶

The process of changing an image so it only uses a small number of colors is known as
**posterizing** (old posters had to be printed with a small number of colors - the
technology didn’t let one make complex blends).

This time, we need to make a function that will force a color value between 0 and 255 to become one of a few specific options.

Write code to return 0 if `colorValue`

is less than 50, 125 if it is 50-124, and
255 otherwise.

Now that you have that function, add it to this program to see it in action:

Rewrite the code for posterizing an image using if and else rather than multiple if’s. Test that it still works correctly.

- 8
- Two possible values of each of red, green, and blue (3 colors) is 2 raised to 3rd power combinations which is 8.
- 3
- Two values of each of red, green, and blue is more than 3.
- 120
- Far fewer
- 16,777,216 (= 256 * 256 * 256)
- That's the total number of colors possible if each channel can be 0-255. But this code reduces that.

How many different colors are possible in our image after we posterize it using this function?

You have attempted of activities on this page