diff --git a/README.md b/README.md index 4d239b8..5e9fa50 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # local-image-mcp +

+ local-image-mcp logo +

+ Minimal Model Context Protocol server for local image inspection. `local-image-mcp` exposes two tools for debugging workflows: @@ -81,6 +85,34 @@ Response content includes: - a text confirmation - an `image` item with base64 data and MIME type +## Usage example + +The following example shows how an AI agent can use `local-image-mcp` together with a Python script to automatically detect and remove a watermark from an image, keeping the subject centred. + +**Prompt given to the agent:** + +> Crop the image in `assets/` to remove the watermark while keeping the drawing centred. Verify the output and overwrite the original. + +**What the agent did:** + +1. Called `list_local_images` on `assets/` to discover `logo.jpg`. +2. Called `load_local_image` to inspect the file visually. +3. Analysed pixel data to locate the watermark (a 4-pointed star in the bottom-right corner at roughly `x: 944–991, y: 944–991` on a 1024×1024 image). +4. Detected the subject bounding box (`x: 153–870, y: 256–808`, centre ≈ 511, 532). +5. Computed a square crop centred on the subject with the right/bottom edge stopping at `940 px` (just before the watermark): + +```python +from PIL import Image + +img = Image.open("assets/logo.jpg") +cx, cy = 511, 532 # subject centre +half = min(940 - cx, 940 - cy) # 408 px +box = (cx - half, cy - half, cx + half, cy + half) +img.crop(box).save("assets/logo.jpg", quality=95) +``` + +6. Called `load_local_image` again to verify the result — watermark gone, subject centred — then overwrote the original and removed the intermediate file. + ## Resources Every successfully loaded image is cached for the current server session and published as a resource: diff --git a/assets/logo.jpg b/assets/logo.jpg new file mode 100644 index 0000000..bc69690 Binary files /dev/null and b/assets/logo.jpg differ