• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit Search
0

Saving an image as TGA with transparency

New Here ,
Jul 31, 2011 Jul 31, 2011

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

Views

44.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jul 31, 2011 Jul 31, 2011

If I recall correctly, for TGA transparency you actually have to save the transparency as an Alpha channel yourself.

Something along these lines:

  • Make sure you have no selection.
  • Right click on the mask that's giving your layer transparency.
  • Click "Add Mask to Selection".
  • Click the Select menu, choose "Save Selection...", and save it as a new alpha channel in your image, call it Transparency.
  • Make sure "Alpha channels" is checked when saving your image.

This is purely from memory; I haven't time to tes

...

Votes

Translate

Translate
LEGEND ,
Jul 31, 2011 Jul 31, 2011

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:

  • Make sure you have no selection.
  • Right click on the mask that's giving your layer transparency.
  • Click "Add Mask to Selection".
  • Click the Select menu, choose "Save Selection...", and save it as a new alpha channel in your image, call it Transparency.
  • Make sure "Alpha channels" is checked when saving your image.

This is purely from memory; I haven't time to test it.

-Noel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 01, 2011 Aug 01, 2011

Copy link to clipboard

Copied

Thanks Noel, it works!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Jul 31, 2011 Jul 31, 2011

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 01, 2011 Aug 01, 2011

Copy link to clipboard

Copied

reowner1 wrote:

...When I save it as PNG transparency shows...

So what is wrong with PNG?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2022 Mar 14, 2022

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 09, 2023 Feb 09, 2023

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

LATEST

What version of photoshop and operating system are you using?

 

Do you have any Alpha channels in the Channels panel?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines