Tomaxxi’s Script: Renaming images from within InDesign

Some time ago Tomaxxi (Marijan Tompa) wrote a small script that allows you to rename images from within InDesign. You might wonder why you’d want to use a script like this? Well, I actually found myself using it this morning as part of an EPUB production process.

I’d received client-supplied print artwork in InDesign, and the Links used in the document contained all sorts of naming conventions. Including the use of special characters. So I decided to perform the big clean-up. I could have used Adobe Bridge’s Batch Rename to convert special characters to underscores etc., but that would have left InDesign displaying a ton of missing links afterwards… What Marijan’s script allowed me to do is rename the images to my liking AND retain the Links in InDesign in one hit. Nice!

Script download / install

Download link: tomaxxiLINKrename.jsx

  • Download the .jsx file from the above link.

To install the script:

  • Show the Scripts panel (Window menu > Utilities)
  • Right click the Application folder
  • From the Script panel menu choose Reveal in Finder

Scripts panel menu. Reveal in Finder selected

  • Double click the Scripts folder
  • Double click the Scripts Panel folder

If you wish to, create a new folder in which you want to organise your scripts (it will appear as such in the Scripts panel).

  • Place the script inside the Scripts Panel folder (or a sub-folder within this folder).

The installed script will now appear in the Scripts Panel.

Script Panel, with script installed.

Using the script

Marijan’s instructions for using the script come down to:

  • Select the image with the Selection tool
  • Run the script
  • Rename image in dialog that appears
  • Click Rename

Rename placed file dialog with current image name editable.

Run Script: You run the script by double clicking it in the scripts panel, or selecting Run Script from the Scripts panel menu, or applying an assigned keyboard shortcut.

Be aware: Clicking a link to an image in the Links panel, will select the Content. Unfortunately, running the [1.0] version of the script when the content is selected throws an error. You must have the Container selected. The easiest way to do that is to press the Esc-key on the keyboard.

Using the Links panel to select images

I found myself working on a document that contained quite a few images that I wanted to rename. So to ensure I didn’t miss any, I used the Links panel to navigate from image to image before executing the script.

So I first of all assigned a keyboard shortcut to the script (Edit > Keyboard Shortcuts… Product Area > Scripts ). Then used the links in the Links panel to select the images in the InDesign document on by one and ran the script to rename.

Step-by-step, illustrations with numbered process steps.

Process I used:

  1. Click image link (and press ESC after that to select the Container)
  2. Run script
  3. Type new name and click Rename
  4. tadaaaa… new name…

If you happen to enter a name that’s already used and click Rename, you’ll receive a warning telling you that a file with the intended new name already exists.

File already exists warning dialog

In this case you have an option to a) Relink the selected image to that particular file (Click Yes), or b) Cancel the rename action, by clicking No .

If you change your mind… and want to Cancel out of the Rename placed file dialog, press Esc.

Some small improvements I’d suggest:

  • Script to work when either Container or Content is selected.
  • Rename placed file dialog to have ‘Rename’ and ‘Cancel’ buttons.
  • File exists dialog: change text to ‘File already exists! Relink image to existing file instead?

Batch renaming: John H. in the 4th comments below points out that there are also batch image rename scripts available for InDesign as well. The last script in the InDesign forum posts he mentions, renames all image links in InDesign based on a ‘base-name’ you enter and adds a counter suffix to that name that numbers each image. E.g. you’d end-up with artwork001.jpg, artwork002.jpg etc.

Also If anyone out there has spotted a Batch Rename script for InDesign that a) retains original names, but turns them into web-friendly names (no spaces, special chars), for instance by replacing those chars with ‘underscores’. Let me know. I’d be happy to add some extra info about that script to my blog.

This Post Has 14 Comments

  1. Anne-Marie says:

    Excellent idea. Adding Tomaxxi’s script to my “epub” folder in my scripts folder.

    I am unable to imagine any workflow where I’d want to use a naming convention that starts with “oph#,” … what is that about?

  2. Cari Jansen says:

    @Anne-Marie :-) toolset’s growing. And you wouldn’t believe it … but the naming convention I used in the example above… was actually taken from a real job I’ve been working on ;-)

  3. John Hawkinson says:

    Just so you know there are a link renaming scripts that can operate on batches — so you should not have to click-run, click-run, click-run. You can just run once.

    Frankly there are so many different link renaming scripts that I cannot keep track of all of them. But one of them can be found as Batch renaming and relinking in InDesign CS4: http://forums.adobe.com/message/2624301.

  4. Cari Jansen says:

    @John :) Thanks heaps for that link :)
    I’d definitely prefer a batch rename over a manual rename ;-)
    For the project I was working on, I had to rename the images with a more meaningful name. E.g. “1234-123.jpg” to ‘typewriter.jpg” ;-) and Tomaxxi’s script did the job for me (although I’d love to see some improvements to that ;-) that automate things further as well … e.g. automatic jumping to ‘next-image’ etc.)
    I’ll add your link to the bottom of the blog-post so those people that don’t read the comments will see there are other options as well :)

  5. This is an amazing tool for me! This one is going into my “Favorites” scripts folder – Once again, this circle of experts has given me another step forward in my job performance and growth. Thanks for sharing -

  6. Cari Jansen says:

    Hi Kathlene, glad Tomaxxi’s script is helpful for you too. :)

  7. jeff brown says:

    The script is AMAZING!! It works perfectly!!

  8. Cari Jansen says:

    Glad you like it Jeff. Marijan’s done a great job on it.

  9. bam1981 says:

    Wonderfully simple script that the editorial team will love! Its going to speed up there job no end, thank you so much.

  10. Cari Jansen says:

    @Ben Glad this is a script you’ll be able to use in production. :)

  11. Christine says:

    WOW….this is EXACTLY what I was looking for!! I am working on redesigning a catalog for one of my clients, and the previous designer had all sorts of different file naming conventions for the files. It was an absolute nightmare sorting through and renaming the images (and then going in and relinking them in ID) until I came across this script…LOVE LOVE LOVE it….THANK YOU:)

  12. Cari Jansen says:

    @Christine :) :) ha, and I love it that you LOVE, LOVE, LOVE it :) :) thanks for the positive response! Cari

  13. ali says:

    thank you sooooooooo much

    i was looking for a way to do that, this will save me a lot of time

  14. Rakesh says:

    This script is owsome!

Leave A Reply