Short answer
Run the image through a captioning model such as BLIP to get a quick first description, then rewrite it yourself for the page it appears on. The AI can say what is in the picture; only you know why the picture is there, and good alt text depends on that purpose.
Follow-up question How do you check that the description is accurate and useful?
Alt text is the short written description attached to an image on a web page, in the alt attribute of the HTML image tag. Screen readers, the software many blind and low-vision people use to browse, read it aloud in place of the picture. It also appears when an image fails to load. Many sites skip it because writing a good description for every photo takes time.
Image-captioning models can help with the first draft. A captioning model looks at a picture and writes a sentence describing it. But a caption and good alt text are not the same thing, and the gap between them is where your judgment comes in.
What a captioning model does
One capable, free option is BLIP, a model from researchers at Salesforce described in a paper first posted in January. BLIP was trained on large numbers of image and text pairs from the web. To deal with messy web captions, its authors had the model write its own captions for training images and then used a filter to discard poor ones, a process they call bootstrapping. The paper reports leading results on several image and language tasks, including captioning.
You don't need to install anything to try it. The project's GitHub page links to a web demo on Hugging Face Spaces and a Colab notebook, a shared online coding page, that runs captioning without a graphics card. You upload a photo, and it returns a one-line description.
What you get is a literal description: the objects, people and setting the model recognizes. That is useful raw material. It is not yet alt text.
Why context changes the right answer
The W3C's Web Accessibility Initiative, which publishes the main web accessibility guidance, explains that alt text for an informative image should convey the meaning the image carries on the page, and that this is usually not a literal description. A detailed description is needed only when the visual content itself is the information. Whether an image is informative at all, or simply decorative, is a decision the page's author makes based on why the image is there.
One of the W3C's examples shows the idea: a stock photo of a smiling family, used to signal that a company is family-friendly, gets alt text about that impression rather than a list of who is in the frame. A captioning model cannot know that purpose. You can.
A worked example: one photo, three pages
Imagine a photo of a baker lifting a tray of round loaves out of an oven. A captioning model might return something like the line below. This output is illustrative; the exact wording varies.
a woman holding a tray of bread in front of an ovenNow edit for the page the photo will appear on. The baker's name and the wording are invented for the example:
| Where the photo appears | Purpose | Edited alt text |
|---|---|---|
| Product page for sourdough | Show the product | Round sourdough loaves with a dark, crackled crust, fresh from the oven |
| "Meet our team" page | Introduce a person | Head baker Lina Moreau taking the morning bread out of the oven |
| Blog banner, with the same scene described in the article text | Decoration | alt="" (empty, so screen readers skip it) |
Notice three changes. The product version drops the person and describes what a shopper cares about. The team version adds a name and role that no model could know. The banner version is empty on purpose: the W3C tutorial notes that when nearby text already covers what the image shows, it can be treated as decorative, and an empty alt attribute lets screen readers skip it.
A few habits keep edits short and useful. Don't start with "image of" or "picture of"; screen readers already announce that it is an image. Put the most important information first. Keep it to a sentence or so for ordinary photos. If an image holds text, such as a sign or a poster, include the words that matter.
Try it: Pick three images from a website or slideshow you manage. Run each through the BLIP demo, paste the caption into a document, then write your own alt text next to it based on why the image is on that page. Note how many words you kept from the machine version.
How do you check that the description is accurate and useful?
Start with accuracy. Captioning models make confident mistakes: they may miscount people, guess the wrong gender or age, misread an object, or describe an action that isn't happening. Compare every claim in the draft with the picture itself. If you can't confirm a detail, such as someone's identity or a location, leave it out or replace it with what you actually know. Be especially careful with descriptions of people; describe what is relevant to the page, not assumptions about who someone is.
Then check usefulness with a simple test: cover the image and read only the alt text in the context of the surrounding paragraph. Would someone who can't see the photo get the same information or impression as someone who can? If the alt text repeats the caption or the paragraph next to it, shorten it or make it empty. If it leaves out something the page relies on, such as the result shown in a chart, add it, or describe it in the main text where everyone can read it.
Finally, listen to it. The screen readers built into most computers and phones, such as VoiceOver on Apple devices and Narrator on Windows, will read your page aloud. Hearing alt text in sequence quickly shows what is too long, what is repetitive and what is missing. AI can save you the blank-page step, but the final description should always be a human decision.
Sources
- Informative Images — Images Tutorial — W3C Web Accessibility Initiative (WAI), June 17, 2019
- BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation — arXiv (Junnan Li, Dongxu Li, Caiming Xiong, Steven Hoi), January 28, 2022
- salesforce/BLIP (README) — Salesforce (GitHub), October 31, 2022