Making Media Accessible: How to Automatically Generate alt Text for Images

Images and videos are critical for ensuring user engagement on the web. For instance, on a retail website, images of a product from different angles or a 360-degree video of the product can lead to higher conversion rates. For a news website, users are more likely to read articles with visual media accompanying the content. It has been reported that posts that include images produce a 650-percent higher user-engagement rate than text-only posts.

Communicating intent to users through contextual images and videos is important. Most websites focus on identifying the context for users who can then visually and auditorily interpret the media. But what about handicapped users? It is equally important to communicate context to those whose disabilities prevent them from interpreting media on websites and mobile apps. The American Disabilities Act (ADA) makes it illegal for any government agency or business in the United States to offer to the public goods and services that are inaccessible to people with disabilities. Entities that offer services and products on the web must comply with the technical requirements in the Web Content Accessibility Guidelines (WCAG) 2.0 Level AA for digital accessibility.

One of the most common pitfalls in enabling accessible content is the lack of alt text in the HTML attribute in the source. Text embedded under alt specifies alternative verbiage that is rendered in place of the related image if it cannot be rendered. More importantly, screen-reader software uses alt text to enable someone who’s listening to the content of a web page, such as a blind person, to understand and interact with the content. According to a survey conducted by WebAIM.org, 89.2 percent of the respondents use a screen reader due to a disability.

This post demonstrates how you can leverage Cloudinary add-ons and third-party APIs to automate the process of generating alt text for media assets as part of your media-management pipeline. Through computer vision and machine-learning algorithms, those add-ons and APIs automatically generate keywords and phrases for alt text to scale—a tremendous time saver if you have thousands of assets.

Here are the Cloudinary add-ons for media recognition and categorization that can automate the generation of alt text:

Alternatively, several third-party services offer APIs for media recognition and categorization. Some examples are CloudSight, Clarifai.ai, and IBM Watson. Also, by using webhooks on Cloudinary, you can build, train, and deploy your own machine-learning models on most cloud providers that can be integrated into the pipeline.

The example below shows you how to automatically generate alt text with Cloudinary’s Amazon Rekognition Auto Tagging add-on and CloudSight.

First, subscribe to the add-on and, if applicable, the service of your choice. Afterwards, tagging and maintaining context to generate alt text for images is extremely simple as part of the upload API call to Cloudinary, as shown below:

The diagram below illustrates a sample workflow for Amazon Rekognition and CloudSight. The green arrows depict the processes that occur synchronously with respect to the upload API call; the orange arrows, those that occur asynchronously.

The process proceeds as follows, step by step:

You upload images to Cloudinary with the upload API.

Cloudinary invokes the webhook specified in the notification_url parameter.

Webhook invokes the CloudSight API to request a natural-language description of the uploaded images. Refer to the CloudSight API documentation for details.

After receiving the description, the webhook updates the context of the images with the explicit API according to the tags from Amazon Rekognition and CloudSight’s natural-language description.

When publishing the images to your website, you obtain their context through the Admin API.

See the interactive demo below for a few examples of images with pre-generated alt text. You can upload an image of your own and have Amazon Rekognition and CloudSight generate its alt text. Start by clicking Upload under Image. The code-level implementation of the demo is different from the workflow described above.

Generating meaningful alt text for a large volume of images to meet WCAG’s legal requirements for digital accessibility can be a daunting task. Not so with Cloudinary, as shown in this post. You can now take a step in the right direction by automating the production of alt text with Cloudinary add-ons or a third-party service of your choice.

That way, you can make media more accessible, simultaneously stimulating and enriching everyone’s browsing experience. What a worthwhile undertaking!

Use Cloudinary to transform, optimize
and manage your images and videos
sign up for free

Recent Blog Posts

ClickMechanic, a London-based, online marketplace for automobile mechanics, has chosen Cloudinary as its media-asset manager for over five years. James Wozniak, ClickMechanic’s full-stack software developer, recently talked with us about the company’s experience with Cloudinary.

These days, clean and sleek e-Commerce web sites are the way to go. And that almost always includes high quality product photos with a flat white, transparent, or solid background. This is not just a passing fad. There are many practical and well-validated reasons for this choice. The graphic below summarizes a few of these:

ImageCon, the ultimate event for digital media is back and promises to be better than ever. Hundreds of developers, creatives, and marketing professionals will gather May 1-2 at the Palace Hotel in San Francisco.

Amy Balliett is the founder and CEO of Killer Infographics, a visual-content marketing and communication agency. Today, Killer Infographics is the industry leader with Amy at the helm, devising visual strategy and running campaigns for global organizations. You can follow Amy on Twitter at @AmyBalliett and @killervizcomm.

Aaron Gustafson is a senior program manager at Microsoft and former manager of the Web Standards Project, collaborates closely with partners on Progressive Web Apps (PWAs) with a focus on cross-platform compatibility. As the author of the groundbreaking book Adaptive Web Design, Aaron regularly posts on aaron-gustafson.com.

The future of marketing depends on dynamic visual experiences. Marketers must connect with customers across multiple channels – the web, mobile, kiosks, email, search, and social as well as print and real time events. They must build brand awareness in increasingly noisy (and competitive) marketplaces. To rise above the noise, marketers must become well-versed in all things rich media -- using images, short and long form videos, and interactive contents in new ways to raise awareness, deliver powerful experiences, and boost engagement.