Swapping images

Many designers occasionally have the task to swap images. InDesign itself offers only basic support by moving frames or copy/pasting the frame contents. As usual life can get easier by script.

Many designers occasionally have the task to swap images. InDesign itself offers only basic support by moving frames or copy/pasting the frame contents. As usual life can get easier by script.

This script is written as startup script, meaning that you place it in "<application folder>/Scripts/Startup Scripts" and restart InDesign. After that you'll find three new entries in the context menu:

Swap images

This takes a note of the filepath of both images and uses a simple place (as in File > Place that you would do manually) to move the images to the other frame. The result is dependant on the scale of the image previously inhabiting the frame and of that preference in the area "Filehandling", whether the scale or the size should be maintained.

Swap frames

The script simply remembers the coordinates indicated by the transform reference point of both frames and moves both frames to each others coordinates.

Load Image in Place Cursor

This "unloads" the frames and places the images into the place cursor so that you can decide at your leasure where to re-put them.

All three scripts are not yet heavily testet but should be undoable in any case. Feedback is welcome.


Indesign CC version 2015.4

Hello, I get this error when I try to SWAP IMAGES. "Either the file does not exist, you do not have permission, or the file mey be in use by another program." SWAP PLACES and LOAD IMAGE IN PLACECURSOR works great.

CC 2015

Works like a charm. Thanks so much for this!

doesnt work across different pages?

seems to not work across different spreads?

doesnt work across spreads

show me how you select images on different spreads and I'll update the script...

swap accross spreads

you cant select things that are on different spreads, but perhaps you could code the scripts to that you select one that you want to swap, and then click swap, then select the target item and it swaps them?

not showing up in edit menu

I tried putting it in the folder you mentioned, but it does not show up in what looks like the edit menu from the screen shot. I also tried putting it in the scripts instead of startup scripts panel, and it gives me an error message. Any suggestions?

not showing up..

"After that you'll find three new entries in the context menu:"

context menu

Thanks for replying, but I do not have a context menu - it looks like it would be the edit menu based on the screen shot, as though I cannot read the German, I see the shortcuts for cut, copy, and paste. Does Indesign made for different countries have different menu names maybe?

try right cllicking on an image

what you see there is called a context menu. because its contents depend on the selection.



CC compatible

Works fine with CC and CS6 !

Version française

Version française à télécharger ici : http://abracadabrapdf.net/download/swapImages_FR.jsx.zip


Great script ! Here is a french version : http://abracadabrapdf.net/download/swapImages_FR.jsx.zip ;-)


Nice, simple and very useful. Thanks


Thank you!! Why in the world InDesign wouldn't have this type of functionality built-in, I have no idea...




Does it work with Win?

Fantastic :-)

Fantastic :-)


Hi Gerald, thanks for that great script. Amazing what a script can do and how it can enhance Indesign functionality. This will be useful!

New version CS5


Really nice script! I don't get it to work on CS5 ...

Modified swap image for CS5

If you want to swap images in CS5 you can use this script. It is simply just one function in Gerald's script. Select two image frames and run the script from the script panel.
var mySelection = app.selection;
if (mySelection.length == 2 && mySelection[0].allGraphics.length > 0 && mySelection[1].allGraphics.length > 0)
if (mySelection[0].allGraphics[0].itemLink.status == LinkStatus.NORMAL && mySelection[1].allGraphics[0].itemLink.status == LinkStatus.NORMAL) {
var firstLink = mySelection[0].allGraphics[0].itemLink.filePath;
var secondLink = mySelection[1].allGraphics[0].itemLink.filePath;
} else {
alert("This cannot work with images whose status is not up-to-date");
} else {
alert("Please select two image frames");


I tried both of your script, and it worked perfectly in my ID CS5! This will make a huge different for me! I'm very grateful!