{
  "openapi": "3.1.1",
  "info": {
    "title": "Chroma Key: Green Screen to Transparent PNG API",
    "version": "1.0.0",
    "summary": "Key out a green or blue screen into a transparent PNG with spill suppression.",
    "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://luminachromakey.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Key out a green or blue screen into a transparent PNG with spill suppression.",
        "description": "Removes a green, blue or any strongly coloured backing from a photo with a colour-difference keyer, un-mixes the backing colour from soft edges, suppresses spill and returns an RGBA PNG plus the matte. The screen colour is picked from the image border automatically or entered as HEX.\n\nMethodology:\n- Colours are decoded to linear light. The matte is a balanced colour difference m(C) = C_dominant − (b·C_other1 + (1 − b)·C_other2) of the screen colour’s dominant channel, and α = 1 − gain·m(C)/m(screen), remapped between clip black and clip white.\n- For a foreground mixed with the screen, C = α·F + (1 − α)·K, the matte is linear in α, so α is recovered exactly for foreground colours with m(F) = 0 (greys, whites, many skin tones) and clamped for others. The screen colour is then removed from edge pixels (premultiplied α·F = C − (1 − α)·K) and remaining spill is limited to the balanced mix of the other channels.\n- Optional shrink (square erosion) and edge softening (Gaussian) act on the matte. Same engine as the Chroma key node in Lumina’s Compositor.\n\nColour-difference keying needs an evenly lit screen; strongly green or blue foreground objects become partly transparent. For general photos without a screen use the background remover instead.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "lumina_chroma_key",
        "x-owner-app": "lumina",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LuminaChromaKeyInput"
              },
              "examples": {
                "example1": {
                  "summary": "Synthetic green-screen plate with automatic screen colour",
                  "value": {
                    "image": {
                      "filename": "green-screen-plate.png",
                      "contentType": "image/png",
                      "contentBase64": "iVBORw0KGgoAAAANSUhEUgAAAMAAAACACAYAAABdhGZrAAAH8ElEQVR42u2d2W9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oABZJHQpwuIZDMmEAmQBueOJhTMmkg0FyCDOIQ+LZnAkIwqQAb4/+yMLpgiSFQVII7LrAa/kVOuKUsmMAqSBuUfLMHLnKoulGJKZZEcBUkQ2hWKh1ESyowCpnPRe4Emv8ifFFzwUIBlkC0C+7s+P8wHJkgKMk4FbZ1igPEGypADjQPatYXHyC8mUArwA87tW8dLmPL2EWrKlAM9BNmtiYfITyZYC/A+re+t44pvnJ8SSMQV4BrIxE4uS30jGFOA/KO0xablHp457kpYaaRtG3uBCtL6BxgiLeL+jEDd+u85yaIJkLZlTgMfsObOfxdAMyZwC8II3XiinuwALusoxdu8OS6EZkrlkr70Ae88eYCE0RbLXXoDua3GWQVMke60FeDk2CdfHrrEMmiLZSwe0FcDcZ2URNEc6oK0A+wcPsgSasz/X+4vm8sljVzpYAs2RDmgrwOmbAyyB5kgHtBVgZGyEJdB9+5SxET0FmNlZgrF7oyyB9m+IjSa6oJ0AFb21/EvtJNEB6YJ2AjQe38wCkATShVz18G/lzkyYal7Y+gAAAABJRU5ErkJggg=="
                    },
                    "key": "auto"
                  }
                },
                "example2": {
                  "summary": "Explicit screen colour, clipped and softened matte",
                  "value": {
                    "image": {
                      "filename": "green-screen-plate.png",
                      "contentType": "image/png",
                      "contentBase64": "iVBORw0KGgoAAAANSUhEUgAAAMAAAACACAYAAABdhGZrAAAH8ElEQVR42u2d2W9UZRjGvdRLvfFOEuOFMTHqnRcSyyYgQkG2lqVYKi2U4kynG+00sggSSFiMCGJgls5MZ+0sLZS2U1q2QoFSlgKCWCrKpv/EY94JiRFE6Kznm++5+CWky8x33uf5lTmdc76+9FKsAIRoC4dAKAAhFIAQCkAIBSCEAhBCAQihAIRQAEIoACEUgBAKQAgFIIQCEEIBCKEAhFAAQigAIRSAEApACAUg//BKrACfRT9FaaQQlZF5CVZG5mB2dGbic5wRBcgrZkdnYUvbcriClejxW3De14gLvvUY8jfgor8ewwnqMOyvxbC/Bn2BKviDZdjeVoR50ZmcIQVQjzdjU/BNqARh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xdu8OS6EZkrlkr70Ae88eYCE0RbLXXoDua3GWQVMke60FeDk2CdfHrrEMmiLZSwe0FcDcZ2URNEc6oK0A+wcPsgSasz/X+4vm8sljVzpYAs2RDmgrwOmbAyyB5kgHtBVgZGyEJdB9+5SxET0FmNlZgrF7oyyB9m+IjSa6oJ0AFb21/EvtJNEB6YJ2AjQe38wCkATShVz18G/lzkyYal7Y+gAAAABJRU5ErkJggg=="
                    },
                    "key": "#00B140",
                    "clipBlack": 0.05,
                    "clipWhite": 0.95,
                    "shrink": 1,
                    "matteBlur": 0.8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LuminaChromaKeyResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "LuminaChromaKeyInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "image": {
            "title": "Photo in front of a screen (PNG, JPEG or WebP, up to 2 megapixels)",
            "type": "object",
            "description": "Upload as {filename, contentType?, contentBase64}. Max 24414 KiB. Accepts .png,.jpg,.jpeg,.webp.",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "key": {
            "title": "Screen colour (HEX, or auto = median of the border)",
            "type": "string",
            "maxLength": 7,
            "default": "auto"
          },
          "gain": {
            "title": "Screen gain",
            "description": "Above 1 removes more of the screen (also from greenish foreground); below 1 keeps more.",
            "type": "number",
            "minimum": 0.2,
            "maximum": 4,
            "default": 1
          },
          "clipBlack": {
            "title": "Clip black",
            "description": "Matte values below this become fully transparent (cleans noisy screens).",
            "type": "number",
            "minimum": 0,
            "maximum": 0.99,
            "default": 0
          },
          "clipWhite": {
            "title": "Clip white",
            "description": "Matte values above this become fully opaque (fills holes in the subject).",
            "type": "number",
            "minimum": 0.01,
            "maximum": 1,
            "default": 1
          },
          "spill": {
            "title": "Spill suppression",
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 1
          },
          "balance": {
            "title": "Red/blue balance",
            "description": "Weight of the first other channel in the colour difference (red for green and blue screens).",
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "default": 0.5
          },
          "shrink": {
            "title": "Shrink matte (px)",
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "default": 0
          },
          "matteBlur": {
            "title": "Soften matte edge (px)",
            "type": "number",
            "minimum": 0,
            "maximum": 20,
            "default": 0
          }
        },
        "required": [
          "image"
        ]
      },
      "LuminaChromaKeyResult": {
        "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",
              "key",
              "autoPicked",
              "transparentPercent",
              "partialPercent",
              "opaquePercent",
              "artifact",
              "matteArtifact"
            ],
            "properties": {
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "key": {
                "type": "string"
              },
              "autoPicked": {
                "type": "boolean"
              },
              "transparentPercent": {
                "type": "number"
              },
              "partialPercent": {
                "type": "number"
              },
              "opaquePercent": {
                "type": "number"
              },
              "artifact": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              },
              "matteArtifact": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}