Skip to main content
Participant
October 13, 2022
Answered

Script to convert .TIF with Path to transparent PNG (action not based on path name)

  • October 13, 2022
  • 3 replies
  • 553 views

Hi all,

I am wondering if someone can help me with a solution to batch convert a library of 36.000 images from .TIF with path to transparent .png files

I created a action script with steps to select the .TIF path and delete the background, after that save it as .png.

But i'm having trouble. Not all files have the same path name. some have Path 1 others have 1/outline/pad 1 etc. 

The current script only runs when the path is named Path 1 but stops when a path is named outline.

Is there a way to generalize the action to select the first path regardless of the name?

Thanks in advance,
Joeri Dullens

This topic has been closed for replies.
Correct answer Stephen Marsh

@Joeri5E20 – This is a limitation with actions, they record absolute path names.

 

If the path is consistently the very top/first path in the path panel, the following JavaScript will select it for you:

 

activeDocument.pathItems[0].select();

 

Or to make a selection from the first path:

 

activeDocument.pathItems[0].makeSelection();

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

3 replies

Stephen Marsh
Community Expert
Community Expert
October 18, 2022

@Joeri5E20 – So, how did the scripts work for you?

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
October 13, 2022

@Joeri5E20 – This is a limitation with actions, they record absolute path names.

 

If the path is consistently the very top/first path in the path panel, the following JavaScript will select it for you:

 

activeDocument.pathItems[0].select();

 

Or to make a selection from the first path:

 

activeDocument.pathItems[0].makeSelection();

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

Joeri5E20Author
Participant
October 18, 2022

Worked like a charm! ❤️

Stephen Marsh
Community Expert
Community Expert
October 18, 2022

@Joeri5E20 – thank you, I wasn't sure if this was consistently the first/top path that varied in the name. Glad you got the result that you needed!

Mylenium
Legend
October 13, 2022

You would simply address it by index. I'm not that deep into PS scripting, but a quick web search turned up this:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/clipping-path-info/m-p/4673305

 

The first function fetches the index of paths and certainly it could be modified to work with your script.

 

Mylenium