Skip to content

Dark spots

Dark spots picks up deeper-pigmented marks — sun spots, age spots, post-inflammatory hyperpigmentation. Larger than freckles; more discrete than melasma patches.

component: dark_spots
request:
query: "components=dark_spots,dark_spots_adjusted,dark_spots_visualization"
response_path: "results[].description == \"dark_spots\""
value_range: [0, 1]
also_request:
- dark_spots_adjusted # alternative overall score (top-level value only)
- dark_spots_visualization # spot-type features, intensity range [0..400]
warnings: [] # dark_spots emits no metric-specific codes
Code: metrics/dark-spots.js. Change the code to change the picture.

renderMetric and drawSpot come from the rendering recipes guide (Recipe 1 — spots); 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 ds = response.results.find((r) => r.description === "dark_spots");
// visualization_data lives on each measurement_locations[] entry, not on the
// top-level finding. Each feature is a "spot": length-1 x[]/y[] arrays.
const markers = (ds.measurement_locations ?? []).flatMap(
(loc) => loc.visualization_data ?? []
);

For “treat these specific spots” UIs, render those markers prominently. For routine recommendations, the aggregate value is enough.

Each measurement_locations[] entry also carries its own per-region value (0..1) alongside its mask_shapes. A region that isn’t analyzed returns value: -1 — treat that as “region unavailable,” not a real low score.

  • Distinction between Freckles and darks spots can be partially overlapping in some cases.

The dark_spots 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 dark_spots.