Easily Add Captions to Graphic Frames
Every now and then a question will be asked in Adobe’s User to User forums about the capability of InDesign to perform a certain task and the answer is so obviously “no” that it’s not unheard of for that to be the one word response. And yes, I’ve been guilty of doing so myself.
On some occasions however, that obvious answer turns out to be not quite so obvious. Such was the case recently when a poster asked if text could be added to a frame already containing a graphic. The fact is that any attempt to do so will prove futile using any of the tools found in InDesign’s user interface. But my fellow Adobe User to User forum host and scripting expert, Dave Saunders, posted a script that will do just that by taking advantage of some features not accessible any other way.
By selecting a graphic frame and launching the script, dummy text will be inserted at the bottom of the frame.
Just replace that with your text and assign any paragraph style you’d like to the text to finish it up.
If you’d like to try it out, you can download the script from here. Once downloaded, copy the script to InDesign’s Scripts Panel folder and it will be accessible in the scripts panel (Window > Automation > Scripts).
FWIW, I stumbled upon this possibility while trying to make sense of the structure of a graph I’d imported from Excel. If you have a line graph (and probably for other options, too), the points on the line are all objects “pasted into” the same rectangle.
Once I realized that, it was suddenly crystal clear that I could use this technique in scripts to achieve the kind of effect shown here by Bob.
Dave
The download link does not appear to work in Safari.
In Firefox, it takes you to a page where the text of the script is listed. If you right-click the link you get the changes to save as…
Dave
The link was broken. I just fixed it and uploaded at as zip file instead. It seems to behave a bit better that way.
Usually captions are placed below the image, at least in the books and magazines I’ve read. Can you, perhaps by using the Paragraph Style, set the text to appear below the picture, or will it be bound within the frame?
I have a script that was mentioned in Caffé Fibonacci, episode 1.
This useful script creates a caption frame based on an associated object style with the caption text itself – which is extracted from the Discription field in the metadata of each picture.
You can choose the height of the frame and the distance it should sit from the picture frame and since you can also choose an object style for that frame, that means you can also define the paragraph style for that caption (since you can append that style to the object style).
You can check that episode at http://www.adobetv.com to see how it works, and you can find the script here: https://tinyurl.com/2nb44r
When I say “I have a script”, I mean I have it my Sripts folder, not that I created it ;)
Looks like a cool script and hack for doing this kind of thing. I must give it go and try it out and pass it on to other people. Many thanks for sharing.
Here’s my ?0.02 on graphic labels.
I tend to use the Label Graphic that came with InD, there is alos a Label Graphics Menu, which adds the Label Graphic to the contextual menu. So you can easily select any image and insert the text, using various ways, file name, path, xml data and something else.
You can assign a style with the dialog box and it even creates a layer called labels in the document. The only thing I can’t see it doing is applying an object style, which of course would be handy.
Alexanda, I downloaded that script, also. It’s very clever but it’s limited in its use as strictly for captions that have already been written and embedded into the graphics as metadata.
The thing I like about Dave’s script is that while it was originally written to add captions it can be revised or just used as a jumping off point toward other things.
You’re not limited to using this for captions. For instance, you can fill that entire frame with text and drop the opacity of the graphic for special affects similar to using a background graphic on a web page.
As always, let your imagination and creativity be your guide.
Another place where my script can come in handy is if the original frame is already inline or anchored. You can run the script and it will insert the caption without the need to take the original out-of-line first, as is necessary for any other approach to adding captions after the fact to anchored frames.
You can also increase the height of the graphic frame so that the text appears below (or above) the image, producing a result identical in look to traditional captions/figure labels.
Dave
This script totally freaks me out, but it makes sense if you understand how it’s put together! The effect is achieved by inserting two separate objects inside the graphic frame: The original image plus a text frame. If you need to reposition the text frame, you can select it with the Direct Selection tool.
In fact, clicking on the image with the Direct Selection tool won’t select the image anymore (as it usually does) because there’s a big text frame in the way. You have to use the Object > Select > Next Object (or use the next/previous object buttons in the Control panel) to select the other object inside the frame (in this case, the image itself).
So, no, Roland, you can’t use this to put the text outside the frame because the text is literally inside the frame.
Great script, Dave, and a great find, Bob! Thank you for sharing it.
Hi,
I’m looking for something similar that can just apply the outer frame + a centered textframe underneith so people can put in their own caption. Most pics won’t have the proper IPTC tags, it would be far nicer if it just worked with any random picture one wants to add.
Can someone tell me how to edit it (or hint to another version) so that pictures don’t need the metadata?
regards
Andreas
Andreas: Steve Wareham did a great job on modifying the LabelGraphics script that comes with InDesign so that it can paste in any text that’s on the clipboard. Very clever, and very handy! I’ll write a post about it soon, but in the meantime, you can find it here. Just unzip it, put it in the scripts panel folder and go for it! (Not sure if this works in CS2.)
Here’s the post with the new script that adds label text frames outside of the graphic frame with text from the clipboard.
I just discovered that I can use this tool to insert captions under pictures, as well. I simply use my selection tool (v) to drag the bottom center handle down. I can adjust the color of this part with my Palette, and then use the addTextToImage script to insert the caption. Then, I can easily resize the box.
What’s more: I don’t have to group any text boxes with the pictures in order to get them to move together! That saves me some time! Thanks a ton, Dave!
The script from David Blatner (above) will make a new text frame below the picture. However, you still have to group the image and text frame and apply text wrapping, etc. to the text frame if it’s in a book. I prefer the addTextToImage script.
Hey… I guess I might have been wrong about being able to resize the graphic frame after you add text using the script. Dave, is there a way you could get them to be able to resize together? I basically want to be able to crop the bottom of the picture after I add the text. InDesign treats the text and the graphic separately…
Right now, I have to use the Direct Selection tool to click the text, then use the Selection tool to resize the text frame, and THEN resize the background frame.
I am working with Live captions and I can not seem to be able to get it to bring in the dimensions from anything other than a photoshop files. When I check my pdfs, they clearly have the page dimensions in the jdf file. what am I missing here?
Thank you! This is just what I was looking for. :)
This is a great tip! I tried and ir works wonderfully! I was even able to resize the image and the text resized proportionally with it. Next I will try to make it a caption text and setup the image frame along with the caption inside as a library items to be ready to use. Thanks Bob