# Edit Banana

> Converts static diagram images into editable DrawIO XML or PPTX using SAM 3 segmentation, multimodal LLM scanning and OCR.

Edit Banana (branded EditFigure on its web app) is a diagram re-editing tool from the BIT-DataLab group. It takes a static image of a diagram and reconstructs it as an editable file, with the web service producing DrawIO XML or PPTX and the open-source repository producing DrawIO XML. The web app can be tried without signing in, and the project is also available as a self-hostable Python codebase.

## What It Is

Edit Banana turns uneditable figures such as flowcharts, architecture diagrams, technical schematics and formula-containing images into editable elements. Shapes, arrows, icons and text are recognized and separated so each can be selected, dragged, restyled or rewritten. The project says it preserves layout logic, color matching, element hierarchy, stroke and fill styles, and arrow styles such as dashed lines and thickness.

## How the Pipeline Works

An input image (the web app accepts JPG, PNG and WEBP; the repository lists PNG, JPG, BMP, TIFF and WebP) is first segmented with a fine-tuned SAM 3 mask decoder. Multi-round scanning with multimodal LLMs guides element extraction. Text is detected with local OCR (Tesseract, with PaddleOCR as an option), and high-resolution crops of formula regions go to Pix2Text for LaTeX conversion. Spatial data and text results are then merged into the final editable output.

## Processing Modes and Editing

The web app offers an All Elements Editable mode that separates shapes, arrows, icons and text, and a Text Editable mode that changes text while keeping layout and graphics intact. The repository also demonstrates human-in-the-loop manual repair and saving results locally.

## Running It Locally

The repository requires Python 3.10+ and recommends a CUDA-capable GPU, though a CPU device can be configured. Setup involves installing PyTorch, the SAM 3 library and weights, and an OCR engine, then copying config.yaml.example to config.yaml. Use the CLI via main.py or start the FastAPI server (server_pa.py) and post images to its /convert endpoint.

## Current Status

The README warns that the GitHub repository trails the web service, which is recommended for the most up-to-date features and performance. Its roadmap lists intelligent arrow connection as in development, and DrawIO template adaptation, batch .drawio export and local VLM support as planned.

## Features
- Converts static diagram images into editable DrawIO XML or PPTX
- Fine-tuned SAM 3 segmentation of diagram elements
- Multi-round multimodal LLM (VLM) scanning
- OCR text recognition with Tesseract or PaddleOCR
- Formula recognition and LaTeX conversion via Pix2Text
- All Elements Editable and Text Editable processing modes
- Preserves layout, colors, element hierarchy, stroke/fill and arrow styles
- Human-in-the-loop manual repair
- CLI and FastAPI web API
- Multi-user concurrency with global GPU lock and LRU embedding cache
- Try without signing in on the web app

## Integrations
DrawIO, SAM 3, Tesseract, PaddleOCR, Pix2Text, Azure OCR, Qwen, GPT-4V, PowerPoint (PPTX)

## Platforms
WINDOWS, MACOS, LINUX, WEB, API, CLI

## Pricing
Open Source

## Links
- Website: https://www.editbanana.net
- Documentation: https://github.com/BIT-DataLab/Edit-Banana#readme
- Repository: https://github.com/BIT-DataLab/Edit-Banana
- EveryDev.ai: https://www.everydev.ai/tools/edit-banana
