# Letterform Mask Comparison > Compare two binary text masks by letterform overlap and aspect ratio. Paste two binary grids representing the same visible text to compare their ink shapes and proportions. Get visual similarity, Dice overlap, intersection-over-union and an aligned SVG overlay. The score compares supplied masks; it does not identify a font or express identity confidence. Part of usefulweb.site (https://usefulweb.site/). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://luminaletterformcompare.usefulweb.site/ (interactive tool at https://luminaletterformcompare.usefulweb.site/tool) - JSON API: POST https://luminaletterformcompare.usefulweb.site/api/v1/calculate with a JSON object of inputs (schema: https://luminaletterformcompare.usefulweb.site/api/v1/tool) - OpenAPI: https://luminaletterformcompare.usefulweb.site/openapi.json - MCP (Streamable HTTP): https://luminaletterformcompare.usefulweb.site/mcp - tool `lumina_letterform_compare` ## Inputs - reference (textarea, required): Reference grid (1 = ink, 0 = background) - candidate (textarea, required): Candidate grid (same text) ## Method - Trim each binary grid to its ink bounds, then independently resample width and height to 128 × 48 using rectangular occupancy at a 35% threshold. Input grids are limited to 128 × 64 and must contain visible ink. - Find the best overlap over ±2 normalized pixels in each direction. Dice = 2 × intersection / total ink; IoU = intersection / union. Clipped pixels still count in the denominator. - Aspect similarity = exp(-3 × abs(ln(referenceAspect / candidateAspect))). Visual similarity = 85% Dice + 15% aspect similarity. Scores are rounded to two decimal places and are not probabilities. - Use identical text and case, one straight line and comparable thresholding. The SVG shows shared ink in dark gray, reference-only ink in orange and candidate-only ink in teal, after alignment. Type Lab uses this engine to rank candidate font renderings locally.