Making Picture Indexes with Captions

This idea had its beginnings with a colleague asking me how to create a caption above an image that would show the filename so that he knew which pictures were placed in a montage, without the need to click on the links panel. It made me wonder if a similar technique could be used to “tag” pictures so that they could then be referenced in an index, such as:

  • Image index
  • Advertisers index
  • Figures index

The principle is simple: apply captions to images, with the captions featuring a paragraph style that has no fill or stroke. The caption references the Title field from the captions dialog box of InDesign. Once all images have had captions applied, then a Table of Contents is run and any duplicates are consolidated.

The complications:

  • Adding data to the metadata information to dozens, possibly hundreds or thousands of images;
  • Consolidating duplicates once a Table of Contents is run.

Part One: Applying the metadata to the caption.

To begin with, the items to be referenced by the index have to contain metadata that can be referenced by the caption. Using the “name” reference will contain the suffix of the filename which can be fixed in further processing, but would be ideal if it did not contain the suffixes.

For this, a different reference will be required from the caption setup, but the items to be referenced have to contain the correct information in the metadata. This requires Bridge to edit the metadata. For the purposes of this article, the caption is going to reference the “Document Title” field in Bridge. This information can be added to this one picture by placing the cursor in the Document Title field of the IPTC (IIM, legacy) portion of the metadata, but this is a solution if there are few pictures.

For a solution which will convert filenames to Document Title names, this is done with scripting. The script can be found in the following link and when installed into Bridge (which is MUCH HARDER than installing scripts into InDesign) will display a new option in Bridge under the tools menu: Add Filename to Title.

Any items selected in Bridge can now have the Document Title reflect the filename without the suffix if the items are highlighted in Bridge and then apply the new menu item “Add Filename to Title”

Once the image is relinked and the caption definition changed to “Title” (this is how InDesign references what Bridge calls “Document Title”) the caption can be applied.

So that the caption doesn’t interfere with any artwork on the page, it will be given a paragraph style which has no fill or stroke in the font; and is placed so that it is on the image but grouped with the picture so it is unobtrusive.

This caption will now act as “tagged” so that its Title can be referred to in a Table of Contents.

Part 2: Consolidating duplicates once Table of Contents is run.

In the next part of this example, captions have been applied captions to hundreds of pictures in a pictorial index but now need to appear sorted by the names of the images of the products. The first image shows a general Table of Contents that was run using the paragraph style in the caption.

The list is in the order that the pictures appeared in the book, but is not in page order. To do this, the data could be:

  • Sorted manually (too time consuming)
  • Using a paragraph sorting script in InDesign to sort the paragraphs (such as this script from Peter Kahrel)
  • Sorted using Microsoft Excel

On this occasion, the contents will be copied and pasted into Excel, then sorted using Excel’s sort function, then copied and re-pasted back into InDesign.

This is better, but there are a series of entries at the end which are duplicated which are “imagetocome” followed by page numbers which they appear.

To do this, two GREPs need to be run. The first GREP is:





run this GREP on the story containing the contents until 0 results are returned.

This will remove exact duplicates through the index but will keep close duplicates (e.g. same name but different page number)

Then, run this GREP:





run this GREP on the story containing the contents until 0 results are returned.

and this will remove close duplicates by consolidating them onto the same line.

The reality is that the entry “imagetocome” was deleted anyway but worth demonstrating.

This site uses Akismet to reduce spam. Learn how your comment data is processed.