Skip to content

feat(api): label renderer (Pillow + qrcode) #17

Description

@strausmann

Goal

Render LabelData + Template + TapeSpec → PIL.Image suitable for the printer.

Tasks

  • LabelRenderer.render(data, template_id, printer_model, tape_spec) -> Image
  • Template schema (JSON: tape_mm, elements [{type, x, y, size, ...}])
  • Element types: text, qr, barcode (Code 128 to start)
  • Pixel-height calculated via PrinterModel.width_to_pixels(tape_spec)
  • 6 seed templates (3 apps × 2 tape sizes 12mm/24mm)
  • Live-preview endpoint POST /api/render/preview returning PNG
  • Layout constants for PT-Series 12mm verified in Phase 0:
    • LABEL_HEIGHT_PX=76, MARGIN_LEFT=8, MARGIN_RIGHT=6, MARGIN_BETWEEN≥20

Activity

  1. strausmann commented on May 15, 2026

    @strausmann
    OwnerAuthor

    Closed by #54 — Pillow + qrcode renderer landed together with the Template schema. backend/app/services/label_renderer.py produces 1-bit bitmaps suitable for the printer plugins, and backend/app/schemas/template.py defines the YAML-loadable template format.

    Default templates for the three integrations (Snipe-IT asset, Spoolman spool, Grocy item) are tracked separately as the next slice of Phase 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions