# Activity 4: Create Basic Filter

Workshop Resources

Now that we understand more about pixels and images, we can start to learn how to design your own filter on the image. Let us see some examples on how to design a basic filter on your image.

### Example for blue filter

We want to add a blue filter on the cute cat above. Let's see how to achieve that.
# We need to import PIL package to allow manipulation with pixels.
from PIL import Image

# Open the cat image
img = Image.open("cat.png")

# Let's add the blue filter
for i in range(img.size[0]): # For every column
for j in range(img.size[1]): # For every row
color = img.getpixel( (i,j) )
img.putpixel((i,j),(0, 0, color[2])) # Set the color accordingly

#Save the cat after filtering
img.save("Mycat.png")


Wow! This is our cat after the blue filter.

### Challenge - Create your own filter

Following the example above, try to create your own filters with different colors.

Finally, please think about and try to create a grey filter. We will talk about how to create a grey filter in the next section.