{
  "markdown": "# asset-optimiser\n\nA [Gemini CLI](https://geminicli.com) extension that optimises image and video\nassets for faster website loading.\n\n- **PNG** → compressed with [oxipng](https://github.com/shssoichiro/oxipng) (lossless)\n- **JPEG** → compressed with [mozjpeg](https://github.com/mozilla/mozjpeg) (lossless or lossy)\n- **WebP** → generated from both (optional, via `cwebp`)\n- **Video** → responsive MP4 + WebM variants from 4K/1080p sources (via `ffmpeg`)\n- **Posters** → JPG + WebP poster frames extracted from video (via `ffmpeg`)\n\nOriginals are **never modified**. All output goes to a separate output folder.\n\n---\n\n## Prerequisites\n\n| Tool | Purpose | Install |\n|------|---------|---------|\n| `oxipng` | PNG compression | `brew install oxipng` / `cargo install oxipng` |\n| `jpegtran` (mozjpeg) | JPEG lossless | `brew install mozjpeg` / `apt install mozjpeg` |\n| `cjpeg` (mozjpeg) | JPEG lossy | bundled with mozjpeg |\n| `cwebp` | WebP conversion | `brew install webp` / `apt install webp` |\n| `ffmpeg` | Video transcoding | `brew install ffmpeg` / `apt install ffmpeg` |\n| `ffprobe` | Video metadata | bundled with ffmpeg |\n\n> **macOS note:** After installing mozjpeg via Homebrew, add it to your PATH:\n> `export PATH=\"/usr/local/opt/mozjpeg/bin:$PATH\"`\n\n---\n\n## Install\n\n```bash\ngemini extensions install https://github.com/rajavijayach/asset-optimiser\n```\n\nOr for local development:\n\n```bash\ngit clone https://github.com/rajavijayach/asset-optimiser\ncd asset-optimiser\nnpm install && npm run build\ngemini extensions link .\n```\n\n---\n\n## Usage\n\n### Via Gemini CLI chat\n\nJust ask naturally:\n\n> \"Optimise all images in ./public/assets\"\n> \"Generate WebP versions of my PNG files in ./src/images\"\n> \"Create responsive video variants from my hero video\"\n\n### Via slash commands\n\n```bash\n# Preview what would be processed\n/optimise:preview ./assets\n\n# Full production run (prompts for confirmation first)\n/optimise:run ./assets\n\n# Check that all required tools are installed\n/optimise:check\n```\n\n### Via MCP tools directly\n\n```\ncheck_tools     — verify required binaries are on PATH\nscan_folder     — preview files without processing\noptimise_assets — run the full optimisation pipeline\n```\n\n---\n\n## Configuration\n\nCopy `.asset-optimiser.json` to your project root and edit to your needs.\nThe file is auto-detected — no extra flags needed.\n\n```json\n{\n  \"folder\": \"./public/images\",\n  \"output_folder\": \"./public/optimised\",\n  \"images\": {\n    \"mozjpeg\": { \"mode\": \"lossless\" },\n    \"webp\": { \"enabled\": true }\n  },\n  \"videos\": {\n    \"enabled\": true,\n    \"ffmpeg_preset\": \"slow\"\n  }\n}\n```\n\n### Profiles\n\nPass `profile` to the `optimise_assets` tool for common use cases:\n\n| Profile | Description |\n|---------|-------------|\n| `quick` | Fast run, modest savings |\n| `balanced` | **Default** — good balance of speed and compression |\n| `max` | Maximum compression, slower (opt-level 6, veryslow preset, WebP on) |\n| `images-only` | Skip all video processing |\n| `videos-only` | Skip all image processing |\n| `ci` | Quiet, fast preset, suitable for CI/CD pipelines |\n\n---\n\n## JPEG Mode Guide\n\n| Mode | Typical saving | Quality impact |\n|------|--------------|----------------|\n| `lossless` (default) | 10–25% | None — pixel-perfect |\n| `lossy` quality 85 | 30–50% | Visually identical |\n| `lossy` quality 75 | 50–65% | Slight softening |\n\n---\n\n## Video Resolution Tiers\n\nThe extension auto-detects source resolution and generates:\n\n| Source | Generated variants |\n|--------|-------------------|\n| 4K (≥3840×2160) | 4K MP4, 1080p MP4, 1080p WebM, 720p MP4 |\n| 1080p (≥1920×1080) | 1080p MP4, 720p MP4, 720p WebM |\n| 720p (≥1280×720) | 720p MP4 |\n| Below 720p | Skipped |\n\nPoster frames (JPG + WebP) are extracted from the first second of each video.\n\n---\n\n## Output Structure\n\n```\npublic/\n├── images/\n│   ├── hero.png          ← original, untouched\n│   ├── banner.jpg        ← original, untouched\n│   └── intro.mp4         ← original, untouched\n└── optimised/\n    ├── hero.png          ← oxipng compressed\n    ├── hero.webp         ← WebP variant (if enabled)\n    ├── banner.jpg        ← mozjpeg compressed\n    ├── banner.webp       ← WebP variant (if enabled)\n    ├── intro_poster.jpg\n    ├── intro_poster.webp\n    ├── intro_1080p.mp4\n    ├── intro_1080p.webm\n    └── intro_720p.mp4\n```\n\n---\n\n## Development\n\n```bash\nnpm run build      # compile TypeScript\nnpm run dev        # watch mode\nnpm test           # run unit tests\nnpm run preflight  # lint + build + test\n```\n\n---\n\n## License\n\nApache-2.0\n",
  "bytes": 4491,
  "sha": "acfa9d66e93f6d6b174cd8007f9784a53345b4ed659b6fc461d939aa37c0f02a",
  "repo_slug": "rajavijayach/asset-optimiser",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_rajavijayach_asset_optimiser_1cefd517/readme"
}