---
title: ToolRouter — Agent Use Case Guide
description: Step-by-step guide for completing a task with a specific AI agent using ToolRouter.
url: https://toolrouter.com/tools/image-ops/use-cases/compress-for-web/copilot
---
# How to Compress Images for Web with Copilot

Copilot integrates image compression into your development pipeline directly from the IDE. Compress assets and immediately add optimization steps to your CI configuration. Copilot can write pre-commit hooks, build-time compression scripts, and Lighthouse performance monitoring code alongside the actual image processing.

## Setup

{"mcpServers":{"toolrouter":{"command":"npx","args":["-y","toolrouter-mcp"]}}}

## Steps

1. Add ToolRouter to your Copilot MCP configuration
2. In Copilot Chat: "Compress this image to under 100KB using image-ops"
3. Review the compressed output
4. Ask Copilot to add image compression to your build pipeline
5. Automate compression for all uploaded images

## Example Prompt

```
Compress all images in /public/images for web. Add a build step that auto-compresses new images.
```

## Tips

- Copilot can add image optimization to your Next.js, Vite, or webpack config
- Set up pre-commit hooks that compress images before they are committed
- Automate compression in your CI pipeline for consistent optimization
