---
tags:
  - macOS
  - Tahoe
  - python
  - pillow
  - PIL
  - image-processing
title: Getting Started with Pillow (PIL) for Image Processing on macOS Tahoe
---

# Getting Started with Pillow (PIL) for Image Processing on macOS Tahoe

Pillow is a powerful and easy-to-use Python library for image processing. It is a fork of the original PIL (Python Imaging Library) and provides a wide range of functionalities for image manipulation, analysis, and format conversion.

## Prerequisites

*   Python 3 installed (recommended to use [Miniconda](miniconda.md) or Homebrew).
*   A virtual environment created using `venv` (see [Creating Python Virtual Environments with venv on macOS Tahoe](venv.md)).

## Installation

1.  Activate your virtual environment:

    ```zsh
    source .venv/bin/activate
    ```

2.  Install Pillow using pip:

    ```zsh
    pip install pillow
    ```

## Basic Usage

Here are a few basic examples of using Pillow:

### 1. Opening an Image

```python
from PIL import Image

img = Image.open("my_image.jpg")
img.show()  # Opens the image in your default image viewer
```

### 2. Resizing an Image

```python
from PIL import Image

img = Image.open("my_image.jpg")
new_img = img.resize((200, 200))  # Resize to 200x200 pixels
new_img.save("my_image_resized.jpg")
```

### 3. Converting Image Format

```python
from PIL import Image

img = Image.open("my_image.png")
img.convert('RGB').save("my_image.jpg") # Convert to JPEG
```

### 4. Cropping an Image

```python
from PIL import Image

img = Image.open("my_image.jpg")
cropped_img = img.crop((100, 100, 300, 300)) # (left, upper, right, lower)
cropped_img.save("my_image_cropped.jpg")
```

## Related Guides
*   Creating Python Virtual Environments with venv on macOS Tahoe
*   Installing Python Packages with Pip Without Sudo on macOS Tahoe