---
title: Batch Mode and JSON Output
description: Squeeze whole directory trees and emit structured output for pipelines.
navigation:
icon: i-lucide-package
---
## Batch mode
Point Squeezer at a directory instead of a single file:
```bash [Terminal]
vision-squeezer ./assets --recursive --output-dir ./assets-optimized --model gemini
```
- `--recursive` walks every subdirectory.
- `--output-dir` mirrors the source tree into the destination, preserving folder structure.
## JSON output
`--json` emits a structured record instead of the human-readable savings table. In single-file mode it's one record; in batch mode it's an aggregate.
```bash [Terminal]
vision-squeezer image.png --model claude --json
```
```json
{
"model": "claude",
"original_tokens": 5344,
"optimized_tokens": 4194,
"tokens_saved": 1150,
"bytes_before": 512000,
"bytes_after": 365000,
"size_reduction_pct": 28.6,
"quality": 75
}
```
## Dry run
Combine `--json --dry-run` to estimate impact across a tree without writing files or updating the stats database:
```bash [Terminal]
vision-squeezer ./screenshots --recursive --json --dry-run --model gpt6
```
This is the recommended way to gate a CI pipeline on projected token savings.
## Persistent analytics
Every real (non-dry-run) optimization is recorded in a local SQLite database at `~/.vision-squeezer/stats.db`.
```bash [Terminal]
vision-squeezer stats
```
| `timestamp` | When the optimization ran |
| `model` | Target model |
| `original_tokens` / `optimized_tokens` | Token counts before/after |
| `bytes_before` / `bytes_after` | File size before/after |
| `mode` | `standard`, `ocr`, or `auto` |
In Claude Code, the `/vision-stats` skill reads this database directly with zero MCP overhead.