Generate Alt Text of Images Using Artificial Intelligence

#Tools & Facts

7th February 2019

Apple, Amazon, Tesla – these are just a few of the global brands that benefit from the use of artificial intelligence and cognitive technology. Your business can go in their footsteps by taking advantage of AI-generated image alt text on your website.

We all know about Siri, Alexa and the self-driving car craze. Amazon wants to take artificial intelligence as far as delivering products before we even order them. But not everyone knows you can use AI on your website right now. The Microsoft Azure Cognitive Services let you generate image alt text for free and the accuracy is very impressive.

How to generate image alt text

You can analyse an image by going to the Image Processing with Computer Vision API site. The tool provides an abundance of information. From accent colour, dominant background and foreground colours, through facial recognition, all the way to a list of tags, suggested caption and identifying adult and “racy” content.

Microsoft's Cognitive Services caption a picture of Elon Musk in front of a red Tesla as "Elon Musk standing in front of a red car".
A picture of Elon Musk analysed in the Azure Computer Vision API.

The AI-generated caption for the above image is “Elon Musk standing in front of a red car.” Not only does the tool identify it’s Elon Musk, but it also estimates his age – and isn’t very far off. The picture was taken around 2014 when Elon was 42.

Some provided tags have an assigned confidence rate. It’s not perfect, as the “train” tag has higher confidence than “automotive”, but that’s one of the very few flaws in this specific example and the picture isn’t obvious for a computer either.

You might be fine doing it manually for a few images but that defeats the purpose. As with almost everything, there’s a WordPress plugin to help you.

Generate image alt text in WordPress

Automatic Alternative Text uses Microsoft’s Cognitive Services Computer Vision API to generate image alt text for pictures uploaded when the plugin is active.

Automatic Alternative Text WordPress plugin captions a picture of a lying lion as "a lion lying in the grass".
Automatic Alternative Text plugin in action.

Setting up the plugin is easy but requires an API key which you can acquire from Microsoft for free (with the “price subject to change” caveat). There’s a detailed installation guide on the plugin’s page.

Another step towards website accessibility

We have highlighted the importance of alternative text in a recent article about website accessibility and now you can make your website accessible for everyone with the use of artificial intelligence.

It’s important to not get too comfortable having the help of AI. You should develop a habit of crafting accessible content and crafting alternative text for images should be a part of it.

We highly recommend revising the AI-generated alternative text. Pictures with little detail usually get spot-on descriptions, but in our example, the cognitive service doesn’t recognise that Elon Musk is charging the car or that the car is a Tesla.

In the end, it’s all for your visitors. Improve their experience by making your website accessible and reap the rewards.

PS In case you were wondering, the Elon Musk photo was identified as neither adult content nor a racy picture. Sorry Elon, you’re only 1.5% racy.

The adult content and racy scores for the picture of Elon Musk were 1%.
Elon Musk isn’t racy.

Here’s What You Should Do Next

If you’d like us to work on your website to increase your profits, please get in touch. No matter where you are in the world.

Talk to us

If you are a little unusure whether we are a good fit for each other, head over to this page to learn about our typical clients.

See who we work with