Save as TGA Photoshop Script
Our pipeline tends to work best when using TGA files for textures (it does work with PSDs but to be honest I don’t really trust it :)) However I’ve always found it a bit cumbersome to actually save out a copy from Photoshop, requiring you to ‘Save As…’, pick the file type, fix the name, yes I do want to overwrite, etc.
I figured a nice little script would streamline this considerbly. And as an added bonus it’s possible to execute a script through an action, which also allows you to assign a keyboard shortcut to it. With this setup I just hit F2 and I get a tga of the current document, no interaction at all, it just spits it out without disrupting anything.
There’s just one thing to watch out for; by design, it will overwrite the old tga file without warning, so you need to make sure that the tgas are treated as a purely automatic intermediate step and shouldn’t be hand altered.
Just save this code to a .jsx file, create a new action and execute the script while it’s recording (File -> Scripts -> Browse…).
var docName = app.activeDocument.name var docPath = app.activeDocument.path.fullName var splitName = docName.split(".") var fileName = splitName[0] for (i=1; i<(splitName.length - 1); i++) { fileName = fileName.concat( ".", splitName[i] ) } var newFileName = docPath.concat( "/", fileName, ".tga") targaFile = new File( newFileName ) targaSaveOptions = new TargaSaveOptions() targaSaveOptions.resolution = TargaBitsPerPixels.THIRTYTWO targaSaveOptions.alphaChannels = true app.activeDocument.saveAs(targaFile, targaSaveOptions, true, Extension.LOWERCASE)