Skip to main content
Participant
February 19, 2022
Answered

Looking for a script to save as targa file

  • February 19, 2022
  • 3 replies
  • 1161 views

I'm looking for advice on creating a script to save a copy of my .psd file as .tga. Id like to be able to name the file the same name as a file that already exists in that directory, with the goal to overwrite that file. Is that possible? Any advice would be appreciated 🙂

This topic has been closed for replies.
Correct answer Kukurykus
with(activeDocument) saveAs(fullName, new TargaSaveOptions, true)

3 replies

Stephen Marsh
Community Expert
Community Expert
February 19, 2022

@Lewis229310445tu7 wrote:

I'm looking for advice on creating a script to save a copy of my .psd file as .tga. Id like to be able to name the file the same name as a file that already exists in that directory, with the goal to overwrite that file. Is that possible? Any advice would be appreciated 🙂


 

Just to be clear:

 

  1. Do you wish to overwrite any existing TGA with the same name as the PSD, retaining the PSD?
  2. Or do you wish to automatically remove the PSD once the TGA version has been saved?
  3. Or do you mean something else?

 

Can you post screenshots or flesh out a more detailed description or step by step?

Participant
February 21, 2022

I would like to retain the PSD - I am basically using photoshop to paint a car in a video game. The game looks for a .tga file sat in a specific folder, and the .tga file has to have a specific name in order to load. Hence why the script will need to overwrite the old file in this folder. I am essentially overwriting the old tga file every time i make a few changes to the paint job, so that i can see how these changes physically look on the 3d model of the car. I am currently manually hitting file > Save a copy > clicking the name of the old file and overwriting it with new .tga file which then immediately loads the paint job in game. Its not a particualarly difficult workflow but I take quite a lot of enjoyment out of painting these cars and a script like this would make the whole experience more streamlined. Thanks for any help you can offer!

Stephen Marsh
Community Expert
Community Expert
February 21, 2022

Have you tried the script from @Kukurykus ?

 

It uses the same name as the PSD and will silently overwrite any existing TGA with the same name as the PSD using 24-bit colour (alpha channels are not saved with this code, however, they could be with a minor addition).

 

Info on saving/installing scripts here:

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

 

Kukurykus
KukurykusCorrect answer
Legend
February 19, 2022
with(activeDocument) saveAs(fullName, new TargaSaveOptions, true)
Participant
February 19, 2022

Just to add, id like to select 24 bits/pixel if possible