Skip to content

Melasma

Melasma is a specific type of hyperpigmentation that presents as larger, irregular patches — typically on cheeks, forehead, and upper lip.

component: melasma
request:
query: "components=melasma,melasma_visualization"
response_path: "results[].description == \"melasma\""
value_range: [0, 1]
also_request:
- melasma_visualization # polygon-area features, 3 intensity levels by default
warnings: [] # melasma emits no metric-specific codes
Code: metrics/melasma.js. Change the code to change the picture.

renderMetric and drawPolygonArea come from the rendering recipes guide (Recipe 3 — polygon areas); get them as files. Edits stay in this browser tab.

This picture shows the metric's visualization_data from a recorded response, drawn on the photo that was analyzed. Click a thumbnail to select a different model. Hold the photo to hide the overlay.

const m = response.results.find((r) => r.description === "melasma");

When both hyperpigmentation and melasma register, surface them as separate findings — they trigger different product categories (sunscreen + tranexamic acid for melasma vs. vitamin C / retinoid for general pigment).

Melasma also returns a per-region breakdown in measurement_locations[] — one entry per face region, each with its own value (0..1), mask_shapes, and (when melasma_visualization is requested) polygon-area visualization_data. A region that isn’t analyzed returns value: -1 — treat that as “region unavailable,” not a real low score.

The melasma metric emits no metric-specific local_warnings[] codes. It inherits global image-quality codes; a skin-mask sampling failure is reported as 401 on the hyperpigmentation finding, not on melasma.