masyv-enhance

AI-powered image enhancement engine — smart pipeline routing, Real-ESRGAN upscaling, SVG vectorization, CLI & Claude plugin

Stars
11
Language
Rust
License
MIT
Updated

MASYV Enhance Engine

License: MIT Stars Issues Last commit

Canva-level image enhancement for developers — via CLI, API, and Claude plugin.

npm License: MIT

Features

  • Smart Pipeline — auto-detects image type (photo, logo, text, illustration) and routes to the optimal processing pipeline
  • AI Upscaling — Real-ESRGAN super-resolution via ONNX Runtime (2x, 4x, 8x)
  • SVG Vectorization — raster-to-vector conversion for logos and icons
  • Multi-format Export — PNG, JPEG, WebP, SVG
  • CLI via NPX — developer-friendly command line interface
  • Claude Plugin — callable as an MCP tool from Claude

Architecture

Input Image → Analyze Type → Route Pipeline → Process → Export
                  │
          ┌───────┼───────┬──────────┐
          ▼       ▼       ▼          ▼
        Photo    Logo    Text    Illustration
          │       │       │          │
      Denoise  Threshold Contrast  Denoise
      AI Upscale Vector  Sharpen   AI Upscale
      Sharpen  Optimize
Detected TypePipeline
PhotoDenoise → AI Upscale (Real-ESRGAN) → Sharpen
LogoThreshold + Cleanup → Vectorize (SVG) or Upscale
TextContrast Boost → Edge Sharpen
IllustrationGentle Denoise → AI Upscale

Quick Start

Install from npm

npm install -g @masyv/enhance

Or build from source

Prerequisites: Rust 1.80+, Node.js 18+

git clone https://github.com/Manavarya09/masyv-enhance.git
cd masyv-enhance

# Build everything
./scripts/build.sh

# Download AI models (optional, ~67MB)
./scripts/download-models.sh

Usage

# Smart enhance — auto-detects image type
masyv enhance photo.jpg --smart

# AI upscale 4x
masyv enhance photo.jpg --mode upscale --scale 4

# Vectorize a logo to SVG
masyv enhance logo.png --mode vectorize --format svg

# Batch process a folder
masyv enhance ./images/ --batch --format webp

# High-quality JPEG export
masyv enhance photo.png --format jpeg --quality 95

Rust binary (direct)

cd core
cargo run --release -- input.png --mode smart --scale 4 --format png

CLI Options

masyv enhance <input> [options]

Options:
  --smart              Auto-detect image type and route to best pipeline
  --mode <mode>        Processing mode: smart, upscale, vectorize, enhance
  --scale <n>          Upscale factor: 2, 4, 8 (default: 4)
  --format <fmt>       Output format: png, jpeg, webp, svg (default: png)
  -o, --output <path>  Output file path
  --quality <n>        JPEG quality 1-100 (default: 90)
  --batch              Process all images in a directory
  --model-dir <path>   Path to ONNX model directory
  --verbose            Enable debug logging

AI Models

For AI-powered upscaling, download the Real-ESRGAN model (~67MB):

./scripts/download-models.sh

Without the model, the engine gracefully falls back to high-quality Lanczos3 interpolation.

Claude Plugin

The engine exposes an enhance_image tool for Claude integration. See plugin/tool.json for the full schema.

{
  "image_path": "/path/to/input.png",
  "mode": "smart",
  "scale": 4,
  "format": "png"
}

Claude can call this tool, receive the processed output path, and describe the result.

Project Structure

masyv-enhance/
├── core/                    Rust engine
│   ├── src/
│   │   ├── main.rs          CLI entrypoint (clap)
│   │   ├── lib.rs           Engine orchestrator
│   │   ├── pipeline/
│   │   │   ├── analyze.rs   Image type detection
│   │   │   ├── enhance.rs   Denoise, contrast, sharpen
│   │   │   ├── upscale.rs   AI super-resolution (ONNX)
│   │   │   ├── vectorize.rs Raster → SVG (VTracer)
│   │   │   └── export.rs    Multi-format output
│   │   ├── models/
│   │   │   └── onnx.rs      ONNX model loader + tiled inference
│   │   └── utils/           Image & filesystem helpers
│   └── models/              ONNX model files (downloaded)
├── cli/                     Node.js NPX wrapper
│   ├── bin/masyv.js         CLI entrypoint
│   └── src/                 Runner + logger
├── plugin/                  Claude MCP tool definition
│   └── tool.json
├── scripts/
│   ├── build.sh             Build Rust + link to CLI
│   └── download-models.sh   Fetch ONNX models
└── tests/samples/           Test images

Tech Stack

LayerTechnology
Core EngineRust
AI InferenceONNX Runtime (ort)
Upscaling ModelReal-ESRGAN x4plus
VectorizationVTracer
Image Processingimage + imageproc
Parallelismrayon
CLIclap (Rust) + commander (Node)

Performance

  • Typical processing: 2-5 seconds for standard images
  • Multi-threaded ONNX inference
  • Tile-based processing for large images (avoids OOM)
  • Lazy model loading (loaded once, reused)

License

MIT