Pillow is a powerful Python library for image processing, built on top of the PIL (Python Imaging Library). It allows you to manipulate images, apply filters, and save them in various formats. Let's dive into the basics!

📌 Installation

Install Pillow using pip:

pip install pillow

🖼️ Basic Operations

Here are some common tasks you can perform with Pillow:

  • Open an image:

    from PIL import Image
    img = Image.open("example.jpg")
    
  • Resize an image:

    resized_img = img.resize((width, height))
    
  • Convert color space:

    grayscale_img = img.convert("L")
    
  • Save the image:

    resized_img.save("resized_example.png")
    

📚 Extended Reading

For more advanced features, check out our Image Processing Tutorial to learn about filters, rotations, and more!

Pillow Tutorial