AI can draft alt text for large image libraries quickly, but it should never publish alt text on its own. A good workflow sends each image to a vision-capable model together with the page’s topic, asks for one short, specific description, flags decorative images, and then has a person review and approve every draft before it goes live. This keeps alt text accurate for screen reader users, useful for search engines, and free of the confident mistakes models sometimes make.
Why alt text matters
- Screen reader users rely on it to understand images; it is a basic accessibility requirement in WCAG.
- Google uses alt text, along with surrounding text, to understand images for search.
- AI systems reading your HTML get a text description of what the image shows.
See accessibility and SEO and image SEO.
What good alt text looks like
| Weak | Good |
|---|---|
| Image of a chart | Bar chart: clicks fell from 15% to 8% of visits when an AI summary appeared |
| Team photo | Three co-founders in the Pune office reviewing a site audit |
| best interior designer pune modern kitchen | Modular kitchen with white laminate shutters and a quartz countertop |
Describe what matters in the context of the page, include important text shown in the image, keep it short, and leave alt empty (alt=””) for purely decorative images.
The drafting script
This Python script sends each image, with the topic of its page, to a vision-capable model through Anthropic’s API and writes drafts to a CSV with an empty column for the approved version.
#!/usr/bin/env python3
"""Draft alt text for images with a vision-capable model, for human review.
Input: images.csv with columns path,page_topic. Output: alt_drafts.csv.
Needs: pip install anthropic; set ANTHROPIC_API_KEY and CLAUDE_MODEL."""
import base64, csv, mimetypes, os
import anthropic
client = anthropic.Anthropic()
PROMPT = ("Write alt text for this image on a web page about: {topic}. "
"Describe what the image shows that matters for the page, in one sentence under 125 characters. "
"Include any important text visible in the image. Do not start with 'Image of'. "
"If the image is purely decorative, reply exactly: DECORATIVE")
with open("images.csv") as f, open("alt_drafts.csv", "w", newline="") as out:
w = csv.writer(out)
w.writerow(["path", "draft_alt", "approved_alt"])
for row in csv.DictReader(f):
media = mimetypes.guess_type(row["path"])[0] or "image/jpeg"
data = base64.b64encode(open(row["path"], "rb").read()).decode()
msg = client.messages.create(
model=os.environ["CLAUDE_MODEL"], max_tokens=100,
messages=[{"role": "user", "content": [
{"type": "image", "source": {"type": "base64", "media_type": media, "data": data}},
{"type": "text", "text": PROMPT.format(topic=row["page_topic"])},
]}],
)
draft = "".join(b.text for b in msg.content if b.type == "text").strip()
w.writerow([row["path"], "" if draft == "DECORATIVE" else draft, ""])
The page topic matters: the same photo of a kitchen needs different alt text on an interior designer’s portfolio and on a recipe page.
The review step
- A person checks each draft against the image and the page, correcting names, numbers and details the model cannot know, such as who is in a photo or which product model is shown.
- Approved text goes into the approved_alt column.
- Only approved text is written back to the CMS, for example through the WordPress REST API’s media endpoint or your CMS’s import.
Models describe what they see; they do not know your products’ names, your staff or your data. That is why review is essential.
Privacy
Photos of people are personal data. Before sending images of identifiable people to an external model, check your provider’s data handling terms and your obligations under the Digital Personal Data Protection Act, 2023, or write those alt texts by hand.
Frequently asked questions
How long should alt text be?
Usually one short sentence. Complex images like charts may need a longer description in the page text, with the key finding in the alt text.
Should we put keywords in alt text?
Describe the image accurately. Relevant words appear naturally; stuffing keywords harms accessibility and is against Google’s guidelines.
Can we automate the whole process?
Drafting, yes. Publishing without review risks errors that mislead screen reader users and search engines.
Sources
- W3C, WCAG 2.2, Success Criterion 1.1.1 (Non-text Content)
- Google Search Central, “Google image SEO best practices”
- Anthropic API documentation, vision and image inputs