{
  "markdown": "<p align=\"center\">\n  <img src=\"assets/logo.png\" width=\"300\" alt=\"VisionSqueezer Logo\" />\n</p>\n\n# VisionSqueezer\n\n<p align=\"center\">\n  <a href=\"https://github.com/eralpozcan/vision-squeezer/actions\"><img src=\"https://img.shields.io/github/actions/workflow/status/eralpozcan/vision-squeezer/ci.yml?label=build\" alt=\"Build\"></a>\n  <a href=\"https://crates.io/crates/vision-squeezer\"><img src=\"https://img.shields.io/crates/v/vision-squeezer\" alt=\"crates.io\"></a>\n  <a href=\"https://www.npmjs.com/package/vision-squeezer\"><img src=\"https://img.shields.io/npm/v/vision-squeezer\" alt=\"npm\"></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-Elastic--2.0-blue\" alt=\"License\"></a>\n</p>\n\nLLM-native image optimization middleware & MCP server. Reduces vision model token consumption by preprocessing images into tile-boundary-aligned, padding-free formats.\n\nWorks with **any agent or editor** that speaks MCP — Claude, GPT, Gemini, Codex, or your own.\n\n---\n\n## Install\n\n### Interactive (recommended)\n\nPicks the client, method, and scope for you:\n\n```bash\nnpx vision-squeezer install\n```\n\nPrompts for:\n- Target CLI — Claude Code / Codex CLI / Qwen Code / OpenCode / Gemini CLI / Kimi CLI\n- Install method (Claude Code only) — `plugin` (bundles MCP + stats/doctor/upgrade skills) or `mcp-add` (server only)\n- Install scope (`mcp-add` only) — `user` (all projects, recommended), `local` (this project only), `project` (share via `.mcp.json`)\n\nScripted setups pass the choices directly:\n\n```bash\nnpx vision-squeezer install --client claude --method plugin --yes\nnpx vision-squeezer install --client claude --method mcp-add --scope user --yes\n```\n\n### Claude Code — plugin marketplace (one-liner, bundles skills)\n\n```\n/plugin marketplace add eralpozcan/vision-squeezer\n/plugin install vision-squeezer-mcp@vision-squeezer\n```\n\nInstalls the MCP server *and* `/vision-stats`, `/vision-doctor`, `/vision-upgrade` skills as a single Claude Code plugin. Restart open Claude Code sessions for the MCP server to attach.\n\n### Claude Code — `mcp add` (server only)\n\n```bash\n# All projects on this machine (recommended)\nclaude mcp add --scope user vision-squeezer -- npx -y vision-squeezer\n\n# This project only (Claude Code's default)\nclaude mcp add vision-squeezer -- npx -y vision-squeezer\n\n# Share with the team via .mcp.json in the repo\nclaude mcp add --scope project vision-squeezer -- npx -y vision-squeezer\n```\n\n### Claude Desktop\n\nAdd to `~/.config/claude/claude_desktop_config.json`:\n```json\n{\n  \"mcpServers\": {\n    \"vision-squeezer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n### Cursor\n\n```bash\ncursor --add-mcp '{\"name\":\"vision-squeezer\",\"type\":\"stdio\",\"command\":\"npx\",\"args\":[\"-y\",\"vision-squeezer\"]}'\n```\n\nOr add to `.cursor/mcp.json`:\n```json\n{\n  \"servers\": {\n    \"vision-squeezer\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n<details>\n<summary><b>Click here to view installation instructions for 10+ other IDEs and Agents (VS Code, JetBrains, Windsurf, Zed, etc.)</b></summary>\n\n### VS Code Copilot\n\nAdd to `.vscode/mcp.json`:\n```json\n{\n  \"servers\": {\n    \"vision-squeezer\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n### JetBrains (IntelliJ, WebStorm, PyCharm)\n\nOpen **Tools → GitHub Copilot → Model Context Protocol (MCP) → Configure**, then add:\n```json\n{\n  \"servers\": {\n    \"vision-squeezer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n### Windsurf\n\nAdd to `~/.codeium/windsurf/mcp_config.json`:\n```json\n{\n  \"mcpServers\": {\n    \"vision-squeezer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n### Gemini CLI\n\n```bash\ngemini mcp add --scope user vision-squeezer -- npx -y vision-squeezer\n```\n\nOr add to `~/.gemini/settings.json` (user) / `.gemini/settings.json` (project):\n```json\n{\n  \"mcpServers\": {\n    \"vision-squeezer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n### Codex CLI\n\n```bash\ncodex mcp add vision-squeezer -- npx -y vision-squeezer\n```\n\nOr add to `~/.codex/config.toml`:\n```toml\n[mcp_servers.vision-squeezer]\ncommand = \"npx\"\nargs = [\"-y\", \"vision-squeezer\"]\n```\n\n### Qwen Code\n\n```bash\nqwen mcp add vision-squeezer -- npx -y vision-squeezer\n```\n\n### OpenCode\n\n`opencode mcp add` is interactive-only, so add directly to `~/.config/opencode/opencode.json` (global) or `opencode.json` in the repo root (project):\n```json\n{\n  \"mcp\": {\n    \"vision-squeezer\": {\n      \"type\": \"local\",\n      \"command\": [\"npx\", \"-y\", \"vision-squeezer\"],\n      \"enabled\": true\n    }\n  }\n}\n```\n\n### Kimi CLI\n\n```bash\nkimi mcp add vision-squeezer -- npx -y vision-squeezer\n```\n\n### Zed\n\nAdd to `~/.config/zed/settings.json`:\n```json\n{\n  \"context_servers\": {\n    \"vision-squeezer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n### Kiro\n\nAdd to `.kiro/settings/mcp.json` (workspace) or `~/.kiro/settings/mcp.json` (global):\n```json\n{\n  \"mcpServers\": {\n    \"vision-squeezer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n### Antigravity\n\nMCP-only, no hooks needed. Configure via the Antigravity MCP settings:\n```json\n{\n  \"mcpServers\": {\n    \"vision-squeezer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"vision-squeezer\"]\n    }\n  }\n}\n```\n\n</details>\n\n### Manual install (Rust binary)\n\n```bash\n# From crates.io\ncargo install vision-squeezer\n\n# Or from source\ngit clone https://github.com/eralpozcan/vision-squeezer && cd vision-squeezer\nmake install   # builds → ~/.local/bin/\n```\n\nThen use the binary path directly in any config above instead of `npx`:\n```json\n{ \"command\": \"vision-squeezer-mcp\" }\n```\n\n> **Tip:** Run `npx -y vision-squeezer --setup` to print ready configs with auto-detected paths.\n\n---\n\n## CLI Usage\n\n```bash\nvision-squeezer path/to/image.jpg \\\n  --mode auto|ocr|standard \\      # default: auto (detects text/grayscale)\n  --format jpeg|webp|avif \\       # default: jpeg\n  --quality 85 \\                  # output quality 1-100 (default: 75)\n  --tile-size 256 \\               # patch size in px (default: 512)\n  --no-crop \\                     # disable padding removal\n  --smart-crop \\                  # edge-energy crop (vs corner-tolerance)\n  --auto-quality 0.95 \\           # binary-search quality to hit SSIM target\n  --bg-tolerance 25 \\             # background detection 0-255 (default: 15)\n  --model claude|gpt4o|gpt5|gemini|llama|qwen|deepseek \\ # model-aware resizing\n  --max-tiles 20 \\                # hard cap on tile count\n  --json \\                        # machine-readable JSON output\n  --dry-run                       # run pipeline, skip disk write\n```\n\n### Batch mode\n\nPass a directory instead of a file:\n\n```bash\nvision-squeezer ./screenshots --recursive --output-dir ./optimized\nvision-squeezer ./screenshots --recursive --json > report.json\n```\n\n---\n\n<details>\n<summary><b>The Math: How Vision Models Bill You in 2026</b></summary>\n\nIf you send raw images to an LLM, you are leaking tokens. Modern vision models do not care about your file size (MB/KB); they only care about **pixel dimensions**, but each provider calculates costs completely differently. `vision-squeezer` simulates these algorithms to find the mathematical minimum size that drops your token usage without losing visual context.\n\n### 1. Claude (Area-Based)\nAs of 2026 (Claude 3.5 / 4.5+), Anthropic uses an **area-based formula**: `Tokens ≈ (Width × Height) / 750`. \nEvery single pixel of solid background or padding costs you tokens. \n* **The Fix:** `vision-squeezer` aggressively crops padding (removing solid color borders). A 1025×1025 screenshot shrinks just enough to drop from 1,400 tokens to 1,024 tokens (**%26 savings**).\n\n### 2. GPT-4.5 / GPT-4o (Tiling & Short-side Scaling)\nOpenAI scales your image to fit inside a 2048px box, then rescales it again so the **shortest side is exactly 768px**. Finally, it chops the image into a grid of **512×512 tiles**. Each tile costs 170 tokens. \n* **The Fix:** If your image's shortest side ends up being 769px, OpenAI will spill over into an entirely new row of 512×512 tiles, doubling your cost. `vision-squeezer` simulates this exact math and snaps the image down by a few pixels so it fits perfectly into the minimum number of tiles.\n\n### 3. Gemini 2.0 / 3.0 (Massive Tiles)\nGemini uses a massive **768×768 tile** system (if the image is > 384px). Each tile is a flat 258 tokens.\n* **The Fix:** An 800×600 image will trigger a 2×1 tile grid (1,032 tokens). `vision-squeezer` snaps it down slightly to fit exactly inside a 768×768 box, dropping the cost to 258 tokens (**%75 savings**).\n\n### 4. Llama 3.2 / 3.3 Vision (560px Tiles)\nMeta's Mllama vision tiles images on a **560×560** grid, capped at 4 tiles (~1601 tokens each).\n* **The Fix:** A 2400×1670 screenshot trimmed to 2400×1200 drops from a 2×2 to a 2×1 canvas: **6,404 → 3,202 tokens (−50%)**. (Llama 4 uses a different vision encoder and is not modeled.)\n\n### 5. Qwen2-VL / 2.5-VL / 3-VL (28px Patch Grid)\nAlibaba's Qwen-VL uses a **28px effective grid** (14px patch × 2×2 merge); `tokens = (W/28)·(H/28)` bounded to `[4, 16384]`.\n* **The Fix:** The patch is small, so area is the lever — a 1024×1024 image with its border stripped to 896×896 drops **1,369 → 1,024 tokens (−25%)**.\n\n### 6. DeepSeek-VL2 (384px Anyres Tiles)\nSigLIP-384 + 2× pixel-shuffle gives 196 tokens/tile on a `(m·384, n·384)` canvas (`m·n ≤ 9`).\n* **The Fix:** An 800×768 image snapped to 768×768 drops from 3×2 to 2×2 tiles: **1,415 → 1,023 tokens (−28%)**. (Open weights — the win is local-inference context, not API billing.)\n\n> Full provider math, exact formulas, and cited sources: **[visionsqueezer.com/providers](https://visionsqueezer.com/providers/claude)**\n\n</details>\n\n## Pipeline\n\n```\nInput image\n  → crop_padding               remove solid-color borders\n  → calculate_optimal_dims     snap to tile boundary (always down)\n  → [enforce_max_tiles]        optional tile budget cap\n  → resize_exact               Lanczos3\n  → [binarize]                 OCR mode only: Otsu threshold\n  → JPEG/WebP encode           configurable quality & format\n```\n\n### 🦀 Why Rust?\n\nVisionSqueezer is a performance-critical middleware. We chose Rust for three uncompromising reasons:\n\n- **Invisible Latency:** Image processing should never be the bottleneck. Rust ensures that snapping, cropping, and encoding happen in milliseconds, making the optimization layer truly invisible to the developer's workflow.\n- **Minimal Footprint:** As an MCP server running in the background of your IDE, VisionSqueezer is designed to be ultra-lightweight, consuming near-zero CPU and RAM when idle.\n- **Wasm-Ready:** Rust's first-class support for WebAssembly allows us to bring the same high-performance optimization to the browser and the Edge (Cloudflare Workers), enabling client-side squeezing before the image even hits the network.\n\n---\n\n### Case Study 1: Standard Image (istanbul.jpg)\nTo demonstrate the impact on standard images, here is the run on a 2400×1670 image (4 MP, 0.5 MB) across the three scenarios:\n\n#### Example 1: Agnostic Optimization (Default)\nWhen no target model is specified, Squeezer reduces the file size and mathematically optimizes boundaries to be generally efficient across all models.\n\n```bash\nvision-squeezer data/istanbul.jpg\n```\n```text\nInput:  2400×1670  (0.5 MB)\nOutput: 2048×1536  (0.3 MB, JPG q75)\nFile:   28.6% smaller\n\n── Token Estimates ─────────────────────────────────────────\nModel          Before    After      Saved\n------------------------------------------\nClaude           5344     4194     1150 (21.5%)\nGPT-4o           1105      765      340 (30.8%)\nGPT-5            1536     1536        0 (0.0%)\nGemini           3096     1548     1548 (50.0%)\n────────────────────────────────────────────────────────────\n```\n\n<details>\n<summary><b>View Advanced Model-Targeted Optimizations (GPT-4o & Claude)</b></summary>\n\n### Example 2: Model-Targeted Optimization (GPT-4o)\nIf you tell Squeezer the target model, it reverses the model's exact internal calculation (e.g. GPT-4.5's 768px short-side scaling algorithm) and mathematically shrinks the image just enough to fit the absolute minimum tile grid.\n\n```bash\nvision-squeezer data/istanbul.jpg --model gpt4o\n```\n```text\nInput:  2400×1670  (0.5 MB)\nOutput: 2399×1200  (0.3 MB, JPG q75)\nFile:   33.6% smaller\n\n── Token Estimates ─────────────────────────────────────────\nModel          Before    After      Saved\n------------------------------------------\nClaude           5344     3838     1506 (28.2%)\nGPT-4o           1105     1105        0 (0.0%)\nGPT-5            1536     1536        0 (0.0%)\nGemini           3096     2064     1032 (33.3%)\n────────────────────────────────────────────────────────────\n```\n*Notice how targeting `gpt4o` perfectly fits the image into a solid 6-tile boundary (2399x1200) mathematically calculated backwards from OpenAI's short-side scaling algorithm. It maximizes resolution exactly up to the point where an extra tile would be billed.*\n\n### Example 3: Model-Targeted Optimization (Claude)\nSince Claude uses an area-based calculation (`W × H / 750`), Squeezer primarily focuses on aggressively cropping solid-color borders and padding to shrink the pixel area without drastically downscaling the core visual detail.\n\n```bash\nvision-squeezer data/istanbul.jpg --model claude\n```\n```text\nInput:  2400×1670  (0.5 MB)\nOutput: 2304×1536  (0.4 MB, JPG q75)\nFile:   21.3% smaller\n\n── Token Estimates ─────────────────────────────────────────\nModel          Before    After      Saved\n------------------------------------------\nClaude           5344     4718      626 (11.7%)\nGPT-4o           1105     1105        0 (0.0%)\nGPT-5            1536     1536        0 (0.0%)\nGemini           3096     1548     1548 (50.0%)\n────────────────────────────────────────────────────────────\n```\n*Claude benefits tremendously from even minor dimension reductions. By snapping the width and height slightly downwards, we immediately shaved off over 600 tokens while preserving the massive 2304×1536 resolution.*\n\n</details>\n\n### Case Study 2: 12-Megapixel High-Res Image (istanbul2.jpg)\nTo demonstrate the impact on massive images, here is the run on a 4096×3072 image (12 MP, 2.2 MB) across the three scenarios:\n\n#### Example 1: Agnostic Optimization\n\n```bash\nvision-squeezer data/istanbul2.jpg\n```\n```text\nInput:  4096×3072  (2.2 MB)\nOutput: 3584×2560  (1.3 MB, JPG q75)\nFile:   39.6% smaller\n\n── Token Estimates ─────────────────────────────────────────\nModel          Before    After      Saved\n------------------------------------------\nClaude          16777    12233     4544 (27.1%)\nGPT-4o            765     1105        0 (0.0%)\nGPT-5            1536     1536        0 (0.0%)\nGemini           6192     5160     1032 (16.7%)\n────────────────────────────────────────────────────────────\n```\n*(Notice the **OpenAI Aspect Ratio Anomaly**: Squeezer removed heavy letterboxing (padding) from this image. By removing the padding, the image became \"wider\". Because OpenAI's API forces the *new* short side to 768px, the wide aspect ratio pushed the long side into a 3rd tile grid column! This is a fascinating edge case where cropping padding mathematically INCREASES your GPT-4o token cost. If you specifically use `--model gpt4o` on this image, Squeezer will detect this paradox and use a different grid constraint).*\n\n<details>\n<summary><b>View Advanced Model-Targeted Optimizations (GPT-4o & Claude)</b></summary>\n\n#### Example 2: Model-Targeted Optimization (GPT-4o)\n\n```bash\nvision-squeezer data/istanbul2.jpg --model gpt4o\n```\n```text\nInput:  4096×3072  (2.2 MB)\nOutput: 4095×2048  (1.2 MB, JPG q75)\nFile:   43.2% smaller\n\n── Token Estimates ─────────────────────────────────────────\nModel          Before    After      Saved\n------------------------------------------\nClaude          16777    11182     5595 (33.3%)\nGPT-4o            765     1105        0 (0.0%)\nGPT-5            1536     1536        0 (0.0%)\nGemini           6192     4644     1548 (25.0%)\n────────────────────────────────────────────────────────────\n```\n*(By explicitly targeting `gpt4o`, Squeezer optimizes the boundaries such that the new aspect ratio is safely contained. While GPT-4o still bills for the 6-tile layout due to the image's inherent width, Squeezer shrinks the file footprint by 43% without sacrificing high-resolution details.)*\n\n#### Example 3: Model-Targeted Optimization (Claude)\n\n```bash\nvision-squeezer data/istanbul2.jpg --model claude\n```\n```text\nInput:  4096×3072  (2.2 MB)\nOutput: 3840×2816  (1.5 MB, JPG q75)\nFile:   31.5% smaller\n\n── Token Estimates ─────────────────────────────────────────\nModel          Before    After      Saved\n------------------------------------------\nClaude          16777    14417     2360 (14.1%)\nGPT-4o            765     1105        0 (0.0%)\nGPT-5            1536     1536        0 (0.0%)\nGemini           6192     5160     1032 (16.7%)\n────────────────────────────────────────────────────────────\n```\n*(Claude's area-based formula again allows massive token savings simply by trimming to the 3840×2816 boundary, preventing you from paying for over 2,300 tokens of pure padding while retaining 10+ megapixels of fidelity).*\n\n> **💡 FAQ: Wait, why did targeting `gpt4o` save 33% of Claude tokens, but targeting `claude` only saved 14%?**\n> *Because of the **Quality vs. Aggression trade-off**. OpenAI enforces a strict maximum internal resolution (2048px). When you target `gpt4o`, Squeezer must aggressively squash the massive 4096px image down to fit OpenAI's constraints (4095x2048). This massive loss in total pixel area mathematically translates to a huge token drop for Claude.*\n> *However, Claude has **no such maximum limits**. When you explicitly target `claude`, Squeezer knows it doesn't need to destroy your image's resolution. It carefully keeps the massive 3840x2816 size to preserve ultra-fine detail, only trimming the absolute minimum padding to give you the most cost-efficient **lossless** version possible.*\n\n</details>\n\n---\n\n## Benchmark / Savings\n\nReal-world token consumption before and after `vision-squeezer` (using standard photos and screenshots without `--max-tiles`). Calculations use updated 2026 billing formulas.\n\n| Original Size | Model | Tokens Before | Tokens After | Saved |\n|---------------|-------|---------------|--------------|-------|\n| **1025 × 1025**<br>*(Screenshot)* | Claude 4.5+<br>GPT-4.5<br>Gemini 2.0+ | 1,400<br>425<br>1,032 | 1,024<br>255<br>258 | **26.8%**<br>40.0%<br>75.0% |\n| **4032 × 3024**<br>*(Phone Camera)* | Claude 4.5+<br>GPT-4.5<br>Gemini 2.0+ | 16,257<br>2,125<br>6,192 | 12,232<br>1,745<br>4,128 | **24.8%**<br>17.9%<br>33.3% |\n| **800 × 600**<br>*(Web Image)* | Claude 4.5+<br>GPT-4.5<br>Gemini 2.0+ | 640<br>255<br>1,032 | 341<br>255<br>258 | **46.7%**<br>0.0%<br>75.0% |\n\n*(Note: GPT-5's high limits mean it rarely requires tiling optimization unless the image exceeds 6000px, but `vision-squeezer` will still crop padding and compress the file size dramatically).*\n\n---\n\n## MCP Tool: `optimize_image`\n\n| Argument | Type | Required | Default |\n|----------|------|----------|---------|\n| `image_base64` | string | ✓ | — |\n| `mode` | `\"auto\"` \\| `\"standard\"` \\| `\"ocr\"` | — | `\"auto\"` |\n| `output_format` | `\"jpeg\"` \\| `\"webp\"` | — | `\"jpeg\"` |\n| `quality` | integer 1–100 | — | 75 |\n| `tile_size` | integer | — | 512 |\n| `crop` | boolean | — | true |\n| `bg_tolerance` | integer 0–255 | — | 15 |\n| `max_tiles` | integer | — | — |\n| `target_model` | `\"claude\"` \\| `\"gpt4o\"` \\| `\"gpt5\"` \\| `\"gemini\"` | — | — |\n\n**Response:**\n```json\n{\n  \"optimized_base64\": \"...\",\n  \"savings_report\": {\n    \"tiles_before\": 48,\n    \"tiles_after\": 35,\n    \"tiles_saved\": 13,\n    \"token_reduction_pct\": \"27.1\",\n    \"size_reduction_pct\": \"58.9\"\n  }\n}\n```\n\n## Config Reference\n\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `quality` | u8 1–100 | 75 | JPEG/WebP output quality |\n| `tile_size` | u32 | 512 | Model patch size (512 = Claude/GPT, 256 = Gemini) |\n| `crop` | bool | true | Remove solid-color padding borders |\n| `bg_tolerance` | u8 0–255 | 15 | Max channel delta for background detection |\n| `output_format` | jpeg/webp | jpeg | Output encoding. WebP is ~30-50% smaller |\n| `max_tiles` | u32 | — | Hard cap on tile count (progressive downscale) |\n| `target_model` | string | — | Model-aware: `claude`, `gpt4o`, `gpt5`, `gemini` |\n\n## Supported Models\n\n| Model | Tile Size | Pre-scaling | Token Formula |\n|-------|-----------|-------------|---------------|\n| Claude 3.5/4.5/4.7 | N/A | None | Tokens ≈ (W × H) / 750 |\n| GPT-4o / GPT-4.5 | 512×512 | fit 2048px → scale short 768px | 85 + tiles × 170 |\n| GPT-5/5.5 | 512×512 | fit 6000px / 10.24M px | min(85 + tiles × 170, 1536) |\n| Gemini 2.0/3.0 | 768×768 | > 384x384 → fit 4096px | 258 per tile (flat 258 if small) |\n\n---\n\n## Advanced Features\n\n### Persistence & Analytics\n\nVisionSqueezer tracks every optimization locally in `~/.vision-squeezer/stats.db`.\n\n```bash\nvision-squeezer stats\n```\n```text\n── VisionSqueezer Analytics ────────────────────────────────\nTotal Optimizations: 42\nTotal Tokens Saved:  842,500\nTotal Bytes Saved:   156.40 MB\nEstimated USD Saved: $2.11\n────────────────────────────────────────────────────────────\n```\n\n### Shell Hook & Claude Code Skills\n\nAdd to `.zshrc` / `.bashrc`:\n\n```bash\neval \"$(vision-squeezer setup-hook)\"\n```\n\nThis installs two things at once:\n\n- **`squeeze` alias** — optimize and capture the output path in one step:\n  ```bash\n  img_path=$(squeeze data/logo.png --model gemini)\n  ```\n- **Claude Code skills** — written to `~/.claude/skills/` automatically on first run\n\n#### Available Skills\n\n| Skill | Trigger | What it does |\n|-------|---------|--------------|\n| `vision-stats` | `/vision-stats` | Show cumulative token & byte savings — reads local stats.db, zero MCP overhead |\n| `vision-doctor` | `/vision-doctor` | Check installed version vs latest npm release, show update command if outdated |\n| `vision-upgrade` | `/vision-upgrade` | Detect install method (cargo/npm/npx) and run the correct upgrade command |\n\n**Example output:**\n\n```\n/vision-stats\n── VisionSqueezer Analytics ────────────────────────────────\nTotal Optimizations: 42\nTotal Tokens Saved:  842,500\nTotal Bytes Saved:   156.40 MB\nEstimated USD Saved: $2.11\n────────────────────────────────────────────────────────────\n\n/vision-doctor\n## VisionSqueezer Doctor\n- [x] Binary found: /usr/local/bin/vision-squeezer\n- [x] Installed version: 0.1.8\n- [x] Latest version (npm): 0.1.8\n- [x] Status: Up to date\n```\n\n**Marketplace install** (alternative to `setup-hook`):\nAdd to `~/.claude/settings.json`:\n```json\n{\n  \"extraKnownMarketplaces\": {\n    \"vision-squeezer\": {\n      \"source\": { \"source\": \"github\", \"repo\": \"eralpozcan/vision-squeezer\" }\n    }\n  }\n}\n```\nThen run `/plugins add vision-stats@vision-squeezer`, `/plugins add vision-doctor@vision-squeezer`, or `/plugins add vision-upgrade@vision-squeezer` in Claude Code.\n\n### Sandbox Mode: \"Think in Code\"\n\nExecute atomic operations locally before the image ever reaches an LLM. The agent decides _how_ to process the image; you pay zero tokens for the intermediate steps.\n\n**CLI:**\n```bash\nvision-squeezer screenshot.png --ops '[{\"op\":\"crop\",\"x\":10,\"y\":20,\"width\":500,\"height\":500},{\"op\":\"binarize\"}]'\n```\n\n**MCP tool — `sandbox_execute`:**\n\n| Argument | Type | Description |\n|----------|------|-------------|\n| `image_base64` | string | Input image |\n| `operations` | array | Ordered list of ops to apply |\n\nSupported ops: `crop`, `grayscale`, `binarize`, `resize`, `contrast`, `brightness`.\n\n### Crawler Integration\n\nOptimize images on the fly in any Playwright/Puppeteer scraping pipeline — zero API token waste on raw screenshots.\n\n```javascript\nawait page.route('**/*.{png,jpg}', async (route) => {\n  const response = await route.fetch();\n  const body = await response.body();\n  const optimized = await squeeze(body); // pipe through vision-squeezer\n  route.fulfill({ body: optimized });\n});\n```\n\n---\n\n## Contributing\n\nPRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for setup and guidelines.\nPlease follow our [Code of Conduct](CODE_OF_CONDUCT.md).\n\n## License\n\nElastic License 2.0 (ELv2) — See [LICENSE](LICENSE) for details.\n",
  "bytes": 24334,
  "sha": "d3fb49e7356721e4015a11ddde852f82ae78b08574c535732b573ba096db8c3d",
  "repo_slug": "eralpozcan/vision-squeezer",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_eralpozcan_vision_squeezer_c846a5f7/readme"
}