Copy link to clipboard
Copied
Hi, I wrote text and with a transparent background, how to I save as TGA....When i open up the tga file the background is white, not transparent.
When I save it as PNG transparency shows.
thanks
If I recall correctly, for TGA transparency you actually have to save the transparency as an Alpha channel yourself.
Something along these lines:
This is purely from memory; I haven't time to tes
...Copy link to clipboard
Copied
If I recall correctly, for TGA transparency you actually have to save the transparency as an Alpha channel yourself.
Something along these lines:
This is purely from memory; I haven't time to test it.
-Noel
Copy link to clipboard
Copied
Thanks Noel, it works!
Copy link to clipboard
Copied
Because so many people using TGA don't understand transparency and alpha -- we only read and write TGA with alpha channels.
(we tried it with transparency, and half the video industry got confused)
Copy link to clipboard
Copied
reowner1 wrote:
...When I save it as PNG transparency shows...
So what is wrong with PNG?
Copy link to clipboard
Copied
This jsx script for save all visible in TGA, with transparency:
#target photoshop
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
var doc = app.activeDocument;
var filename = doc.name;
var filepath = doc.path;
filename = filename.slice(0, filename.lastIndexOf("."));
var file = new File(filepath +"/" + filename + ".tga");
//------------------------------------------- Duplicate file
var duppedDocument = app.activeDocument.duplicate();
app.activeDocument = duppedDocument;
//-------- Выбираем видимый слой, иначе мердж не работает, и обьединяем видимое
if (1 < duppedDocument.layers.length) {
for (var j = 0; j < duppedDocument.layers.length; j++) {
if (duppedDocument.layers[j].visible){
duppedDocument.activeLayer = duppedDocument.layers[j]
j = duppedDocument.layers.length;
}
}
duppedDocument.mergeVisibleLayers();
}
makeAlpha_from_Transparancy();
function makeAlpha_from_Transparancy()
{
//Выделение прозрачного
var id4556 = charIDToTypeID( "setd" );
var desc983 = new ActionDescriptor();
var id4557 = charIDToTypeID( "null" );
var ref657 = new ActionReference();
var id4558 = charIDToTypeID( "Chnl" );
var id4559 = charIDToTypeID( "fsel" );
ref657.putProperty( id4558, id4559 );
desc983.putReference( id4557, ref657 );
var id4560 = charIDToTypeID( "T " );
var ref658 = new ActionReference();
var id4561 = charIDToTypeID( "Chnl" );
var id4562 = charIDToTypeID( "Chnl" );
var id4563 = charIDToTypeID( "Trsp" );
ref658.putEnumerated( id4561, id4562, id4563 );
desc983.putReference( id4560, ref658 );
executeAction( id4556, desc983, DialogModes.NO );
//Сохраняем выделение в новый канал
var id4564 = charIDToTypeID( "Mk " );
var desc984 = new ActionDescriptor();
var id4565 = charIDToTypeID( "Nw " );
var id4566 = charIDToTypeID( "Chnl" );
desc984.putClass( id4565, id4566 );
var id4567 = charIDToTypeID( "At " );
var ref659 = new ActionReference();
var id4568 = charIDToTypeID( "Chnl" );
var id4569 = charIDToTypeID( "Chnl" );
var id4570 = charIDToTypeID( "New " );
ref659.putEnumerated( id4568, id4569, id4570 );
desc984.putReference( id4567, ref659 );
var id4571 = charIDToTypeID( "Usng" );
var id4572 = charIDToTypeID( "UsrM" );
var id4573 = charIDToTypeID( "RvlS" );
desc984.putEnumerated( id4571, id4572, id4573 );
executeAction( id4564, desc984, DialogModes.NO );
var CH =duppedDocument.channels[3];
duppedDocument.selection.store(CH,SelectionType.REPLACE);
}
function Save_as_TGA() {
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putInteger(cTID('Dpth'), 8);
var desc2 = new ActionDescriptor();
desc2.putInteger(cTID('Vrsn'), 6);
desc2.putEnumerated(cTID('Mthd'), sTID("hdrToningMethodType"), sTID("hdrtype2"));
desc2.putDouble(cTID('Exps'), 0);
desc2.putDouble(cTID('Gmm '), 1);
desc2.putBoolean(sTID("deghosting"), false);
desc1.putObject(cTID('With'), sTID("hdrOptions"), desc2);
executeAction(sTID('convertMode'), desc1, dialogMode);
};
function step4(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putInteger(cTID('BtDp'), 32);
desc2.putInteger(cTID('Cmpr'), 1); //RLE Compression
desc1.putObject(cTID('As '), cTID('TrgF'), desc2);
desc1.putPath(cTID('In '), new File(file));
desc1.putInteger(cTID('DocI'), 223);
executeAction(sTID('save'), desc1, dialogMode);
};
step1(true,0); //
step4(); //
};
//=========================================
// Save_as_TGA.main
//=========================================
//
Save_as_TGA.main = function () {
Save_as_TGA();
};
Save_as_TGA.main();
duppedDocument.close(SaveOptions.DONOTSAVECHANGES);
app.activeDocument = doc;
Copy link to clipboard
Copied
The answer appears to have become irrelevant in the last 12 years, anyone no how to do this in 2023? The option to select an alpha layer while trying to save as a .tga is greyed out. I'm lost.
Copy link to clipboard
Copied
What version of photoshop and operating system are you using?
Do you have any Alpha channels in the Channels panel?
Copy link to clipboard
Copied
CC 24.5.0 I need to know how to do this as well
Copy link to clipboard
Copied
My transparent one is a .png I can't get a transparent tga version
Copy link to clipboard
Copied
If you have a png with transparency you can load the transparency as selection by Ctrl or Cmd clicking on the Layer thumbnail in the layers panel. Then go to your Channels panel and click on the Save Selection as Channel icon at the bottom of the Channels panel.
In the File>Save As dialog click Save a Copy and select Targa from the drop down File Formats menu.
Make sure Alpha Channel s is checked and in the Targa Options dialog check 32 bits/pixel.
Copy link to clipboard
Copied
Save as copy only gives me PSD as format option
Copy link to clipboard
Copied
Alpha channels box in save as dialog is not checkable though save as copy is
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Your document needs to be 8 Bits/Channel in order to Save As a Targa.
Image>Mode
Copy link to clipboard
Copied
Hey sorry, found a workaround that I don't recall anymore and forgot to check back on here. I was/am running the current version of CC, fully updated. I don't recall whether or not I had an alpha layer in the channels panel. Thanks for the responses though, hope this discussion will help someone else with the same issue.