Skip to main content
Known Participant
March 26, 2023
Question

Can I change the linked image using expressions?

  • March 26, 2023
  • 1 reply
  • 985 views

Is there a way to set a layer's image to an image located in a specific folder using expressions?

 

I'm hoping to create a template wherein I can use a spreadsheet to automatically update dozens of images, rather than Ctrl-H for each one in the comp.

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
March 26, 2023

I don't know of any way to change a layer's source with an expression. I think the closest you could come would be to have all the images set up as layers in your comp with opacity expressions to turn off all of them except the one selected in your data file. You could do it with a script though, that you run whenever you change your file, but that's a bit of work to set up...

NotSeanTAuthor
Known Participant
March 27, 2023

Thanks for the response. I figured it was a long shot. 

I'll be adding photos in the future. I don't have them to make layers at the moment. 

My next best idea is to make a placeholder folder, put the new photos in a different folder with the same filenames, then delete the original photo to break the links, and point to the new folder for only the first one. It's the only way I can think to save a ton of Ctrl-H work.

Dan Ebberts
Community Expert
Community Expert
March 27, 2023

It would be a fairly straightforward scripting project, where you have a template project set up with placeholder media, you launch the script which prompts you to navigate to your text/xml/json/csv file that contains file paths to replacement media, the script imports the new files and replaces the layers' sources with the new files. Nothing fancy, but a bit of work, expecially if you haven't done any scripting before. It would be a good (but challenging) first script though...