{
  "openapi": "3.1.1",
  "info": {
    "title": "Raster Artwork to SVG API",
    "version": "1.0.0",
    "summary": "Trace logos and flat artwork into real SVG paths with a limited color palette.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://luminarastervectorizer.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Trace logos and flat artwork into real SVG paths with a limited color palette.",
        "description": "Upload a PNG, JPEG or WebP and trace sampled pixels into editable polygonal SVG paths. Set color count or a custom palette, switch to black and white, remove a border color and drop small regions. The file tool uploads to the server; Lumina Vector Lab runs locally.\n\nMethodology:\n- Exact polygonal outlines of sampled pixels; collinear vertices are removed. No bitmap is embedded in the SVG. Curves are not fitted.\n- Colors use nearest Euclidean encoded-sRGB distance. Alpha is thresholded to opaque or transparent. Small connected regions are dropped to transparency, not merged.\n- Border removal deletes every region of the most frequent opaque border color, including interior regions of that color. Ties use the first palette color.\n- At most 512 pixels per side, 2048 shapes and 60000 nodes. Use logos, icons or flat artwork; photographs may need fewer colors and lower sampling.\n- Decode the first image, auto-orient, convert to 8-bit sRGB, and downsize to 512 pixels per side before nearest-center sampling. Automatic colors reuse Lumina Palette Studio histogram extraction. Four-connected flood fill labels each region, directed boundary edges form closed rings, and even-odd fill preserves holes.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "lumina_raster_vectorizer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LuminaRasterVectorizerInput"
              },
              "examples": {
                "example1": {
                  "summary": "Trace a simple red image",
                  "value": {
                    "image": {
                      "filename": "sample.png",
                      "contentType": "image/png",
                      "contentBase64": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEX/////AADrWueTAAAAEklEQVQI12NgIBb8/09dgjgAAPcnH+GApkH4AAAAAElFTkSuQmCC"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LuminaRasterVectorizerResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "LuminaRasterVectorizerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "image": {
            "title": "Image (PNG, JPEG or WebP; 8 MB, 16 MP maximum)",
            "type": "object",
            "description": "Upload as {filename, contentType?, contentBase64}. Max 7813 KiB. Accepts .png,.jpg,.jpeg,.webp.",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "mode": {
            "title": "Tracing mode",
            "type": "string",
            "enum": [
              "color",
              "mono"
            ],
            "default": "color"
          },
          "colors": {
            "title": "Automatic color count",
            "type": "number",
            "minimum": 2,
            "maximum": 16,
            "default": 6
          },
          "resolution": {
            "title": "Longest sampled side (pixels)",
            "type": "string",
            "enum": [
              "64",
              "128",
              "256",
              "384",
              "512"
            ],
            "default": "256"
          },
          "threshold": {
            "title": "Black / white threshold",
            "type": "number",
            "minimum": 0,
            "maximum": 255,
            "default": 128
          },
          "alpha": {
            "title": "Minimum visible alpha",
            "type": "number",
            "minimum": 1,
            "maximum": 255,
            "default": 128
          },
          "minArea": {
            "title": "Drop regions smaller than this pixel count",
            "type": "number",
            "minimum": 0,
            "maximum": 256,
            "default": 4
          },
          "background": {
            "title": "Background",
            "type": "string",
            "enum": [
              "keep",
              "border"
            ],
            "default": "keep"
          },
          "palette": {
            "title": "Custom HEX palette (optional; 2–16 colors)",
            "type": "string",
            "maxLength": 160,
            "default": ""
          }
        },
        "required": [
          "image"
        ]
      },
      "LuminaRasterVectorizerResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "width",
              "height",
              "shapes",
              "holes",
              "nodes",
              "dropped",
              "background",
              "palette",
              "svg"
            ],
            "properties": {
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "shapes": {
                "type": "integer"
              },
              "holes": {
                "type": "integer"
              },
              "nodes": {
                "type": "integer"
              },
              "dropped": {
                "type": "integer"
              },
              "background": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "palette": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "svg": {
                "type": "string"
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}