Alt Text Is a Label: Turning HTML Metadata into a Searchable Image Library

 Alt Text Is a Label: Turning HTML Metadata into a Searchable Image Library


You have 2,000 images and no labels. Tagging them by hand is a week of work; an auto-tagger that guesses "product photo" for everything is worse than nothing. Meanwhile the page you downloaded them from already carried the answer — in alt, in title, in JSON-LD, in the filename — and your collector threw all of it away.


This post is about harvesting those free labels, ranking them by how much you can trust them, and turning them into a real retrieval layer.


WHERE LABELS ACTUALLY LIVE


Every image on the web sits inside markup that describes it, often several times over:


- img alt — the accessible description. Not always present, not always useful, but frequently precise: "Nike Air Zoom Pegasus 40, white/orange, side view".

- title and aria-label — parallel descriptions, sometimes the only one.

- figure > figcaption — editorial captions, often the richest prose.

- JSON-LD blocks — schema.org Product with name, sku, brand, and image; ImageObject with caption/description; NewsArticle with headline.

- Open Graph — og:image:alt and og:title, usually a hand-written summary.

- Sitemap image extensions — image:title and image:caption per URL.

- Microdata attributes — itemprop="name", data-product-name, data-testid, which survive even when the visible text is generic.

- The filename itself — nike-pegasus-40-white-orange-01.jpg is a label string that survived every CDN transform.


The important realization: these are independent descriptions of the same object. Where they agree, you have a high-confidence label. Where they disagree, the disagreement is usually informative — a templated alt versus a specific caption.


RANKING THE SIGNALS


Not all of these are equal. A working tier list, from strongest to weakest:


Tier 1 — JSON-LD Product.name / sku: structured, machine-generated, rarely stuffed with marketing copy.

Tier 2 — figcaption, long alt (more than 8 words): human-written, describes the actual image.

Tier 3 — short alt / title / aria-label: human-written but terse; may describe function ("close").

Tier 4 — slug-like filename: author-entered at upload, survives transforms.

Tier 5 — surrounding heading or first paragraph: contextual but noisy; often about the page, not the image.

Tier 6 — og:title, page title: aggregate-level; applies to many images equally.

Tier 7 — boilerplate alt ("product image"): worse than nothing — it is a false label.


The last row is the trap. A collector that takes every alt at face value ends up with 800 images labelled "product image" and a search that returns everything for any query.


NORMALISATION BEFORE INDEXING


Raw strings are unusable as facets. Three passes:


Structural. Lowercase, Unicode NFKC, collapse whitespace, strip trailing site branding ("— ExampleStore"), strip the dimension suffix CDNs append (-1024x768, _AC_SL1500_). Extract identifiers with a regex pass: SKUs, model numbers, sizes — anything matching [A-Z0-9]{2,}-[A-Z0-9]{2,} is worth its own facet.


Linguistic. Tokenise, drop a multilingual stop-word list, keep noun phrases. Cheap heuristic that pays: if the string contains a known brand token plus a category token, treat those as separate facets rather than one opaque phrase.


Statistical. Compute document frequency across the whole collection. A token that appears in 60% of images describes the site, not the image — drop it. A token appearing in 3% is specific and should be preserved verbatim. This one pass removes most boilerplate.


FROM LABELS TO RETRIEVAL


With a per-image term set {term, source, tier} stored in an index, four things become possible without any model:


1. Faceted search — filter by brand, category, colour, SKU; the facets were free.

2. Bootstrap clustering — group images that share a Product.name before computing any embedding; clusters of one are likely mislabelled or unique items, and become your review queue.

3. Weak supervision — label a few hundred images with the tier-1/2 signals, then use those as anchors to calibrate an embedding-based classifier. You are not training from scratch; you are checking that the embedding agrees with the free labels.

4. Conflict detection — an image whose JSON-LD says "Pegasus 40" and whose alt says "running shoe" is fine; an image whose alt says "Pegasus 40" but whose filename says hoodie-01.jpg is worth a second look.


The best part: the same pipeline works for deduplication. Two images with identical tier-1 labels are usually the same product photographed twice — perceptual hashing tells you whether they are the same pixels, and the labels tell you whether they are the same thing.


WHAT USUALLY GOES WRONG


- Lazy-loaded images carry placeholder alt until the loader fires; read the metadata after intersection, not at parse time.

- Decorative images legitimately have empty alt (empty is a signal, not a failure); treating empty as "no data" pollutes the index.

- i18n — the same product on regional sites has different alt text; keep the language tag with the term instead of merging.

- Keyword stuffing — some SEO-driven sites put 40 words into alt. Cap the term count per image and prefer JSON-LD when both exist.

- Alt describing function — "search icon", "close". Filter by an icon vocabulary before indexing.


WHERE OMNIPIC FITS


OmniPic AI Studio Pro captures exactly this layer while it scans: for each image candidate it reads alt, title, aria-label, the enclosing figcaption, JSON-LD product data, and the filename slug, normalises them, tags them with their source and tier, and keeps them attached to the asset alongside the EXIF/ICC/XMP metadata and the 64-bit perceptual hash.


Results go straight to Eagle or Billfish with tags intact, or into a streamed ZIP at 2,000+ images without re-encoding — and the search in the collected library works on labels and on local embeddings, on your machine, with nothing uploaded.

OmniPic AI Studio Pro dashboard running a site-wide image inspection
OmniPic AI Studio Pro — one-click site-wide image inspection.



TRY IT


OmniPic AI Studio Pro is on Chrome, Edge, and Firefox:


https://chromewebstore.google.com/detail/omnipic-studio-pro/cokoeaaaglgcljahaffjeijomhmkljlc


Scan a store or a gallery, open the metadata panel, and look at the labels it recovered — then search your collection by brand or by SKU instead of by filename.


评论

此博客中的热门博文

Running AI in the Browser: WebGPU-Accelerated MobileNet Feature Extraction for Real-Time Image Search

Why Image Scrapers Silently Fail: CORS, Tainted Canvases, and Blob URLs

Why Your Image Crawler Collects Blur Placeholders (and Misses the Images Hiding in CSS)