Files
ai-game-2/tools/ora_editor
Bryce e66fa4d715 Fix Alpine.js initialization by moving oraEditor function to <head>
- oraEditor function now defined in <head> before x-data directive
- Added <body> tag with x-data attribute
- Added canvas click handler using () to access Alpine instance
- Added id to imageContainer for canvas interaction
- All tests passing (16/16)
2026-03-27 09:21:56 -07:00
..
2026-03-27 08:59:18 -07:00
2026-03-27 08:58:40 -07:00

ORA Editor - Browser-based OpenRaster Editor

A web-based tool for editing ORA (OpenRaster) files with layer management, polygon drawing, and AI-powered mask extraction.

Quick Start

cd tools/ora_editor

# Activate venv and install dependencies
source ../venv/bin/activate  # or your Python environment
pip install -r requirements.txt

# Run the Flask server
python app.py

The editor will be available at: http://localhost:5000

Features

  • Open PNG/ORA files: Enter file path relative to project root
  • Layer management: Toggle visibility, rename, delete, reorder layers
  • Polygon drawing: Draw polygons to guide mask extraction
  • Mask extraction: Use ComfyUI to extract masks from images
  • Krita integration: Open layers in Krita for manual editing
  • Settings: Configure ComfyUI server URL

Usage Workflow

  1. Open a file: Enter path to PNG or ORA file (relative to /home/noti/dev/ai-game-2)
  2. View layers: See all layers with visibility checkboxes
  3. Draw polygon (optional): Describe the area you want separated
  4. Extract mask: Enter subject description and click "Extract Mask"
  5. Review results: See preview modal with extracted mask
  6. Add to ORA: Click "Use This Mask" to add as new layer
  7. Edit in Krita (optional): Select layer, open in Krita for manual work
  8. Save: Persist all changes

ComfyUI Setup

  • Default URL: 127.0.0.1:8188
  • Configure via Settings gear icon
  • Workflow file must exist at tools/image_mask_extraction.json

API Endpoints

Endpoint Method Purpose
/api/open POST Open PNG/ORA file
/api/save POST Save current state
/api/layers GET Get layer list
/api/layer/* POST Layer operations (add, rename, delete, reorder)
/api/polygon POST Draw polygon overlay
/api/mask/extract POST Extract mask via ComfyUI
/api/krita/open POST Open layer in Krita

Testing

# Test ORA operations
python test_ora_ops.py

# Test Flask API
python test_app.py