Skip to main content
Glama
Image Zoom Viewer
by KeremPl
README.md
# Antigravity Image Viewer

A native **MCP Apps** custom file viewer plugin for **Google Antigravity App (`v2.34.0+`)** that replaces the built-in side-panel image preview with a fast, interactive viewer supporting cursor-centered zoom, pan, 1:1 pixel inspection, rotation, flip, and transparency backgrounds — with zero host patching.

## Features

- **Native replacement via MCP Apps `file` entrypoint** — automatically takes over image file tabs opened from chat `file://` links, the file tree, or the Overview panel.
- **Smooth cursor-centered zoom (`5%` – `3200%`)** via mouse wheel, trackpad pinch, toolbar buttons, or keyboard.
- **Click-and-drag pan** and arrow-key navigation.
- **Edge-to-edge Fit & 1:1 Actual Size** toggle (including double-click toggle).
- **Crisp pixel mode (`Auto` / `Crisp` / `Smooth`)** for inspecting pixel art, textures, and UI assets.
- **Rotate 90° & Horizontal Flip** controls.
- **Background switcher** (`Checkerboard` / `Dark` / `Light`) for checking transparent PNG/WebP/SVG assets.
- **Theme-aware** — automatically follows Antigravity's light and dark host theme tokens.
- **Zero context pollution** — `file` entrypoint tools are hidden from the model by Antigravity.

## Supported Formats

`.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`, `.svg`, `.bmp`, `.ico`, `.avif`

## Installation

Pre-built `dist/server.mjs` and `dist/viewer.html` are included, so no build step is required to install.

### Option 1: Clone directly into Antigravity's plugins folder

**macOS / Linux:**
```bash
git clone https://github.com/KeremPl/antigravity-image-viewer.git ~/.gemini/config/plugins/image-zoom-viewer
```

**Windows (PowerShell):**
```powershell
git clone https://github.com/KeremPl/antigravity-image-viewer.git "$env:USERPROFILE\.gemini\config\plugins\image-zoom-viewer"
```

Antigravity automatically discovers plugins in `~/.gemini/config/plugins/`. Click any image file or `file://` image link to open it in the side panel (restart the MCP server from **Customizations → Installed → Image Zoom Viewer** if it doesn't activate immediately).

## Controls & Shortcuts

| Action | Control / Shortcut |
| --- | --- |
| Zoom in / out (cursor-centered) | Mouse wheel / Trackpad pinch |
| Zoom in / out (step) | `+` / `-` |
| Pan | Click & drag, or Arrow keys (`Shift` for faster) |
| Toggle Fit ↔ `100%` (or `200%`) | Double-click canvas |
| Fit to view | `F` or `0` |
| Actual size (`1:1`) | `1` |
| Rotate 90° CW / CCW | `R` / `Shift+R` |
| Flip horizontal | `H` |
| Cycle pixel mode (`Auto` / `Crisp` / `Smooth`) | `P` |
| Cycle background (`Checker` / `Dark` / `Light`) | `B` |

## Requirements & Notes

- Requires **Antigravity App `v2.34.0+`** (MCP Apps `com.google.antigravity/ui` `file` entrypoint).
- Antigravity's `antigravity-file://` resource reader enforces a **10 MiB** file size limit per file.
- Update-safe: lives entirely inside your user plugin directory and never modifies Antigravity's application binaries.

## Development

```bash
npm install
npm run build
agy plugin validate . --strict
```

- `src/server.mjs` — Stdio MCP server registering the `file` entrypoint tool and `ui://image-zoom-viewer/viewer.html` resource.
- `src/ui/` — Self-contained TypeScript/CSS/HTML viewer bundled into `dist/viewer.html` via `esbuild`.
- Because Antigravity fetches `ui://` resources fresh on each tab mount, UI edits apply as soon as you rebuild and reload the tab.

## License

[MIT](./LICENSE) © 2026 Kerem Pulcu