is now part of CreativePro.com!

A Script to Apply Alt Text from Image Captions

10

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?

empty alt text

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:

  1. Select the image and corresponding caption
    alt text script and image caption selected
  2. Run the script and select the alternative text tab in the Export Options dialog box.caption text copied to alt text

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.

applying a keyboard shortcut to a script in InDesign

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!
René is a graphic designer, scripter, and consultant based in Austria. Learn more about him here.
  • Yes, it takes a much higher calling to become a scripture. :-)

  • Naomi says:

    My experience is with ePub and HTML, not PDFs, so the rules might be different, however I suspect the logic is the same. Although setting the alt text as the caption seems like a good solution, in reality it is not recommended. The reading system will simply read the same text twice, causing frustration. You are not providing any additional accessibility by duplicating the caption as an alt tag.

    • Dear Naomi, the paragraph style for the image caption has an “artifact tag” (PDF tag option in the section tags export) applied to it. In this way the the text in the PDF is only read once by a screen reading device.

  • Colin Flashman says:

    I think since the move from InDesignSecrets to CreativePro, the download to the script itself is missing. I’ve logged in and attempted to download the script, but then greeted by a 404 error.

  • Aaron A says:

    Rene, you say the script also handles anchored graphics, but I don’t see how to make this work; the script requires selecting 2 frames, whereas selecting an anchored object does not allow also selecting a frame. Could you describe the process please?

    • Rene Andritsch says:

      Dear Aaron, the image and the caption together as a group are meant to be the anchored object. That is not specific enough in the article. I get that fixed.

  • >