# Image Optimization

> Resizing, compressing formats, and applying image filters using Pillow.

- Skill: `lord1egypt/image-optimization` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lord1egypt/image-optimization`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lord1egypt/image-optimization/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT license
- Author: Lord1Egypt (https://skillmd.com/u/lord1egypt)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/lord1egypt/image-optimization

---


# Image Optimization

## Overview
Pillow is the friendly PIL fork by Alex Clark and Contributors, providing image processing routines.

## When to Use This Skill
Use to compress static user uploads, resize avatars, or convert images to WebP.

## Quick Start (with runnable code examples)

```python
from PIL import Image

def optimize_img(input_path, output_path):
    img = Image.open(input_path)
    # Compress and convert to WebP
    img.save(output_path, "WEBP", quality=80)
    print("Image compressed successfully.")
```

## Advanced Usage
Generate thumbnails while maintaining aspect ratio, apply blurring filters, extract pixel colors, and build watermarks.

## Key References
- [Pillow Documentation](https://pillow.readthedocs.io/)

## Dependencies
- pillow>=10.0.0

