How theheavydriver/pixel2layer works
Pixel2Layer turns uploaded artwork into an editable, confidence-scored scene graph, then supports browser editing, saving, sharing, and export. The main workflow runs from upload through an asynchronous reconstruction job and back to the editor. The graph also preserves the documented tools, grouping, templates, batches, and optional SAM 2 segmentation capabilities. Some relationships are documented in the README or visible in the source index; unsampled route and UI internals are not inferred beyond that evidence.
Main entry points: pipeline.py Reconstruction pipeline · main.py API application · pipeline_worker.py Pipeline worker · editor-screen.tsx Layered editor
Components 28
Web application
- Upload flow
apps/web/src/components/upload-modal.tsx - API client
apps/web/src/lib/api.ts - Layered editor
apps/web/src/components/editor/editor-screen.tsx - Canvas editor
apps/web/src/components/editor/canvas-editor.tsx - Shared scene schema
packages/schema/src/index.ts
API and workflow
- API application
apps/api/app/main.py - Upload validation
apps/api/app/services/upload_service.py - Reconstruction jobs
apps/api/app/services/job_queue.py - Pipeline worker
apps/api/app/services/pipeline_worker.py - Authentication
apps/api/app/services/auth.py - Stored asset delivery
apps/api/app/api/routes/storage.py
Reconstruction
- Reconstruction pipeline
apps/api/app/services/pipeline.py - Progressive routing
apps/api/app/services/progressive.py - Text detection
apps/api/app/services/text_detector.py - Font matching
apps/api/app/services/fonts/matching.py - Shape detection
apps/api/app/services/shape_detector.py - Region segmentation
apps/api/app/services/segmenter.py - Vector paths
apps/api/app/services/vectorizer.py - Scene graph builder
apps/api/app/services/scene_graph_builder.py - Confidence scoring
apps/api/app/services/confidence.py - Scene graph models
apps/api/app/schemas/scene_graph.py - Optional SAM 2
apps/api/app/services/finetune/sam2_segmenter.py
Persistence
- Blob storage
apps/api/app/services/storage.py - Projects and sharing
apps/api/app/services/store.py
Product features
- Tools and grouping
apps/api/app/api/routes/tools.py - Export formats
apps/api/app/services/export_service.py - Templates and batches
apps/api/app/api/routes/templates.py
Other components
- User
Connections 30
- User → Upload flow: uploads artwork
README.md - Upload flow → API client: submits image
- API client → API application: calls API
README.md - API application → Upload validation: accepts uploads
apps/api/app/main.py - Upload validation → Blob storage: stores original
apps/api/app/services/upload_service.py - API application → Reconstruction jobs: starts queue
apps/api/app/main.py - Reconstruction jobs → Pipeline worker: dispatches work
apps/api/app/main.py - Pipeline worker → Blob storage: reads and writes
apps/api/app/services/pipeline_worker.py - Pipeline worker → Reconstruction pipeline: runs pipeline
apps/api/app/services/pipeline_worker.py - Reconstruction pipeline → Progressive routing: classifies complexity
apps/api/app/services/pipeline.py - Reconstruction pipeline → Text detection: detects text
apps/api/app/services/pipeline.py - Reconstruction pipeline → Font matching: matches fonts
apps/api/app/services/pipeline.py - Reconstruction pipeline → Shape detection: detects shapes
apps/api/app/services/pipeline.py - Reconstruction pipeline → Region segmentation: segments regions
apps/api/app/services/pipeline.py - Reconstruction pipeline → Vector paths: vectorizes artwork
apps/api/app/services/pipeline.py - Reconstruction pipeline → Scene graph builder: builds scene
apps/api/app/services/pipeline.py - Reconstruction pipeline → Blob storage: stores cutouts
apps/api/app/services/pipeline.py - Reconstruction pipeline → Scene graph models: produces model
apps/api/app/services/pipeline.py - Reconstruction pipeline → Optional SAM 2: may use backend
README.md - Pipeline worker → Reconstruction jobs: reports progress
apps/api/app/services/pipeline_worker.py - API application → Projects and sharing: initializes store
apps/api/app/main.py - API application → Stored asset delivery: registers route
apps/api/app/main.py - User → Layered editor: edits reconstruction
README.md - Layered editor → Canvas editor: renders layers
- Layered editor → Shared scene schema: uses scene schema
apps/web/src/components/editor/editor-screen.tsx - User → Tools and grouping: uses image tools
README.md - User → Export formats: exports artwork
README.md - User → Templates and batches: uses templates and batches
README.md - API application → Authentication: serves authentication
- User → Projects and sharing: saves and shares projects
README.md