A Script to Apply Alt Text from Image Captions
Need to add alt text to images to make your documents more accessible? Here's a way to automate the process, thanks to a cool free script.
Recently I discussed with a colleague the feature of adding custom alternative text to an image in InDesign in order to export accessible PDFs which enhance the experience of readers with disabilities. This feature, which also lets you use description metadata that is stored with images has been around since CS5.5.
But what if you don’t have any description metadata to draw information from?

As an editorial designer, I mostly work with layouts in which images are accompanied by captions. I thought it would be nice to have the option to quickly transfer a caption’s content to the user-defined alt-text in the Object Export Options dialog box without even opening it.
As I’m not a scripter myself, I asked Peter Kahrel if he knew of a script that could perform exactly that task. He didn’t, but he answered my request with a little script that does exactly what I was looking for. Here’s how to use it:
- Select the image and corresponding caption

- Run the script and select the alternative text tab in the Export Options dialog box.

Works like a charm! You might think: “What if my image frame and text frame are grouped (or anchored inside a story)?“ Don’t worry. The script also handles that.
To be even more efficient, you can assign a keyboard shortcut to run the script. Choose Edit > Keyboard Shortcuts, and in the dialog box, choose Product Area: Scripts.

This allows you to quickly go through your document and create custom alternative text for images with the push of a button.
Thank you Peter!
PS: If you find this script useful, please use the Donate button at Peter’s website (found on any of the script pages) where you can acknowledge the vast amount of free scripts he provides that can save you valuable hours of work!
PPS: Read this article for more information about installing scripts on your computer.
If you are logged in with either a free or paid InDesignSecrets membership, the download link appears below.
Not a member yet? Sign up here!This article was last modified on August 30, 2023
This article was first published on February 24, 2016
