What is Alt Text Generation?
Alt text (alternative text) is a textual description of an image read aloud by screen readers. People with visual impairments rely on these descriptions to understand image content. Good alt text is not a nice-to-have but a fundamental requirement for accessible websites.
Formidex uses the ViT-GPT2 model, which analyzes images and automatically generates fitting descriptions. The model combines a Vision Transformer (ViT) for image recognition with GPT-2 for text generation, producing natural-sounding descriptions.
The WCAG (Web Content Accessibility Guidelines) require all informative images to have alternative text. Search engines also use alt text to index images. Good alt text simultaneously improves accessibility and SEO.
How does Alt Text Generation work?
The Vision Transformer splits the image into small patches and analyzes their relationships. It recognizes objects, scenes, and actions. This visual information is then passed to the GPT-2 language model, which formulates a coherent description.
The model generates English descriptions that you can use as a starting point and adjust as needed. For non-English websites, it is recommended to translate the generated text and adapt it to the page context.
Tips for best results
Use the generated alt text as a starting point and customize it. The AI describes what it sees but does not know your website's context. Add important details relevant to the specific context.
Keep alt text concise. Screen readers read the entire text aloud, so descriptions should ideally be one to two sentences. Avoid phrases like "image of" or "photo of" since the screen reader already announces it as an image.
Decorative images that add no informational value should receive an empty alt attribute (alt=""). This way, the screen reader skips them and does not interrupt the reading flow.
Common use cases
Improve website accessibility: many websites have hundreds of images without alt text. Automatic generation lets you quickly create descriptions for all images and retroactively ensure accessibility.
SEO optimization: search engines cannot see images and rely on alt text. Well-described images appear more frequently in image search and can drive additional traffic to your website.
Team content management: when many people maintain content, alt text is often forgotten. Automatic generation can serve as quality assurance, ensuring no image is published without a description.