Export to the file with Alpha layer

Hello

I m looking to create an Automation that takes each layer in a Photoshop Document and export it to a TIFF file with an Alpha channel.

There was very little action that export the layer selected as a TIFF with Alpha and there is of course the function of 'layer to export to files '.

I don't know how I can combine these functions, and it would be great if I could get this feature in a droplet.

Maybe you can guide me in the right direction

It treats pixel and the type of layers and masks on the groups would apply, perhaps you want to give it a try.

Save your hair without transparency, but with pixels alpha channels and layers type;

2014, use it at your own risk.

#target photoshop

If (app.documents.length > 0) {}

myDocument var = app.activeDocument;

var myDocument.name.match = basename (/(.*)-.) [ ^\.] +$/)[1];

try {var docPath = myDocument.path}

catch (e) {var docPath = "~ / Desktop"};

var theDup = myDocument.duplicate ("thecopy", false);

deleteAlphaChannels();

main (theDup, docPath, basename);

theDup.close (SaveOptions.DONOTSAVECHANGES);

};

////////////////////////////////////

getAllLayersBounds.jsx

main function (dittos, docPath, basename) {}

showAllLayers();

get the number of layers;

Var ref = new ActionReference();

ref.putEnumerated (charIDToTypeID ("Dcmn"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

var applicationDesc = executeActionGet (ref);

var number = applicationDesc.getInteger (stringIDToTypeID ("numberOfLayers"));

//////

for (var m = 0; m<= thenumber;="" m++)="">

try {}

Var ref = new ActionReference();

ref.putIndex (charIDToTypeID ("Lyr"), m);

var layerDesc = executeActionGet (ref);

var layerSet is typeIDToStringID (layerDesc.getEnumerationValue (stringIDToTypeID ("layerSection")));.

isBackground var = layerDesc.getBoolean (stringIDToTypeID ('background'));

var layerKind = layerDesc.getInteger (stringIDToTypeID ("layerKind"));

theName var = layerDesc.getString (stringIDToTypeID ('name'));

"adjustment".

otherwise the layer group.

If (layerSet! = "layerSectionEnd" & layerSet! = "layerSectionStart" / * & isBackground! = true * /) {}

If (layerKind == 1 | layerKind == 3) {}

hideOthers (m);

do twice;

var theDup2 = theFile.duplicate ("thecopy2", true);

addTransparencyAsChannelaAndFlatten();

Save and close;

saveCopyAsTif (theDup2, docPath + ' / ' + name of base + '_' + theName ".tif");

theDup2.close (SaveOptions.DONOTSAVECHANGES);

hideOthers (m)

};

//

};

}

catch (e) {};

};

};

substance.

function addTransparencyAsChannelaAndFlatten () {}

try {}

transparency mask;

// =======================================================

var idMk = charIDToTypeID ("Mk");

var desc3 = new ActionDescriptor();

var idNw = charIDToTypeID ('Nw');

var idChnl = charIDToTypeID ('channel');

Desc3.putClass (idNw, idChnl);

var idAt = charIDToTypeID ('At');

ref2 var = new ActionReference();

var idChnl = charIDToTypeID ('channel');

var idChnl = charIDToTypeID ('channel');

var idMsk = charIDToTypeID ("Msk");

ref2.putEnumerated (idChnl, idChnl, idMsk);

Desc3.putReference (idAt, ref2);

var idUsng = charIDToTypeID ("Usng");

var idUsrM = charIDToTypeID ("rocket");

var idTrns = charIDToTypeID ("Trns");

Desc3.putEnumerated (idUsng, idUsrM, idTrns);

executeAction (idMk, desc3, DialogModes.NO);

alpha channel of the layer mask.

// =======================================================

var idDplc = charIDToTypeID ("Dplc");

var desc4 = new ActionDescriptor();

var idnull = charIDToTypeID ("null");

Ref3 var = new ActionReference();

var idChnl = charIDToTypeID ('channel');

var idOrdn = charIDToTypeID ('Ordn');

var idTrgt = charIDToTypeID ("Trgt");

Ref3.putEnumerated (idChnl, idOrdn, idTrgt);

Desc4.putReference (idnull, ref3);

executeAction (idDplc, desc4, DialogModes.NO);

remove the layer mask;

// =======================================================

var idDlt = charIDToTypeID ("Dlt");

var desc5 = new ActionDescriptor();

var idnull = charIDToTypeID ("null");

ref4 var = new ActionReference();

var idChnl = charIDToTypeID ('channel');

var idChnl = charIDToTypeID ('channel');

var idMsk = charIDToTypeID ("Msk");

ref4.putEnumerated (idChnl, idChnl, idMsk);

Desc5.putReference (idnull, ref4);

executeAction (idDlt, desc5, DialogModes.NO);

flatten;

// =======================================================

var idFltI = charIDToTypeID ("FltI");

executeAction (idFltI, undefined, DialogModes.NO);

} catch (e) {}

};

by mike hale, through paul riggott.

http://forums.Adobe.com/message/1944754#1944754

function selectLayerByIndex (index, add) {}

Add = undefined? Add = false: Add

Var ref = new ActionReference();

ref.putIndex (charIDToTypeID ("Lyr"), index);

var / / desc = new ActionDescriptor();

desc.putReference (charIDToTypeID ("null"), ref);

If (Add) desc.putEnumerated (stringIDToTypeID ("selectionModifier"), stringIDToTypeID ("selectionModifierType"), stringIDToTypeID ("addToSelection'));

desc.putBoolean (charIDToTypeID ("MKV"), false);

try {}

executeAction (charIDToTypeID ("slct"), desc, DialogModes.NO);

} catch (e) {}

Alert (e.message);

}

};

Remove alpha channels.

function deleteAlphaChannels () {}

Var ref = new ActionReference();

ref.putEnumerated (charIDToTypeID ("Lyr"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

ref.putEnumerated (charIDToTypeID ("Dcmn"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

var docDesc = executeActionGet (ref);

var theChannels = docDesc.getString (stringIDToTypeID ("numberOfChannels"));

Check the channels;

for (var m = theChannels; > 0; m - m) {}

ref2 var = new ActionReference();

ref2.putIndex (charIDToTypeID ("one"), m);

var channelDesc = executeActionGet (ref2);

Alpha var = channelDesc.hasKey (stringIDToTypeID ("alphaChannelOptions"));

Remove alpha channels;

If (alpha == true) {}

keep the channels spots;

If (channelDesc.getObjectValue (stringIDToTypeID ("alphaChannelOptions")) .getObjectValue (strin gIDToTypeID ("color")) .hasKey (stringIDToTypeID ("book")) == false) {}

// =======================================================

var idDlt = charIDToTypeID ("Dlt");

var desc7 = new ActionDescriptor();

var idnull = charIDToTypeID ("null");

var ref1 = new ActionReference();

Ref1.putIndex (charIDToTypeID ("one"), m);

desc7.putReference (idnull, ref1);

executeAction (idDlt, desc7, DialogModes.NO);

};

};

};

};

Save pdf.

function saveCopyAsTif (myDocument, path) {}

tif options;

tifOpts = new TiffSaveOptions();

tifOpts.embedColorProfile = true;

tifOpts.imageCompression = TIFFEncoding.TIFFLZW;

tifOpts.alphaChannels = true;

tifOpts.byteOrder = ByteOrder.MACOS;

tifOpts.layers = true;

Save the copy;

myDocument.saveAs ((new File (path)), tifOpts, true);

};

hide others.

function hideOthers (theIndex) {}

hide the other;

// =======================================================

var idShw = charIDToTypeID ("Shw");

var desc10 = new ActionDescriptor();

var idnull = charIDToTypeID ("null");

var officielle4 = new ActionList();

ref7 var = new ActionReference();

Ref7.putIndex (charIDToTypeID ("Lyr"), theIndex);

LIST4.putReference (ref7);

desc10.putList (idnull, list4);

var idTglO = charIDToTypeID ("TglO");

desc10.putBoolean (idTglO, true);

executeAction (idShw, desc10, DialogModes.NO);

};

by mike hale, through paul riggott.

http://forums.Adobe.com/message/1944754#1944754

function selectLayerByIndex (index, add) {}

Add = undefined? Add = false: Add

Var ref = new ActionReference();

ref.putIndex (charIDToTypeID ("Lyr"), index);

var / / desc = new ActionDescriptor();

desc.putReference (charIDToTypeID ("null"), ref);

If (Add) desc.putEnumerated (stringIDToTypeID ("selectionModifier"), stringIDToTypeID ("selectionModifierType"), stringIDToTypeID ("addToSelection'));

desc.putBoolean (charIDToTypeID ("MKV"), false);

try {}

executeAction (charIDToTypeID ("slct"), desc, DialogModes.NO);

} catch (e) {}

Alert (e.message);

}

};

Display all layers.

function showAllLayers () {}

get the number of layers;

Var ref = new ActionReference();

ref.putEnumerated (charIDToTypeID ("Dcmn"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

var applicationDesc = executeActionGet (ref);

var number = applicationDesc.getInteger (stringIDToTypeID ("numberOfLayers"));

//////

for (var m = 0; m<= thenumber;="" m++)="">

try {}

// =======================================================

idHd var = charIDToTypeID ("Shw");

var desc9 = new ActionDescriptor();

var idnull = charIDToTypeID ("null");

var list1 = new ActionList();

Ref3 var = new ActionReference();

Ref3.putIndex (charIDToTypeID ("Lyr"), m);

List1.putReference (ref3);

desc9.putList (idnull, list1);

executeAction (idHd, desc9, DialogModes.NO);

}

catch (e) {};

};

};

Tags: Photoshop

Similar Questions

Maybe you are looking for

  • Do not get the new look of Firefox 4

    I upgraded my Firefox 4.0.1 desktop (Windows XP, but I still don't have the same 'look' as with the previous version.) I uninstalled and then did install a new one, but still not 'old' aspect is however the 4.0.1 version Firefox, however on my laptop

  • Satellite L500-164 - keyboard must change in English or Greek

    Hello I am a student in Germany now and I was thinking of buying the Satellite L500-164.The problem is, in all stores, you can buy it only with the German keyboard I completely hate. Is it possible to change it to an English (or Greek)?How much will

  • C4480 printer does not print on the internet

    I hope I'm doing this right.  I tried searching for this problem.  I'm awfully lack of navigational skills.  And many computer skills, I'm afraid. I have Windows Vista and just downloaded IE9, but the problem started when I was with IE8.  The upgrade

  • Microsoft has a software that cleans, repairs and fix registry errors for free?

    Clean and fix free registry errors Microsoft has a software that cleans, repairs and fix registry errors for free

  • Pavilion 15: get a new motherboard

    I need some tips to get a new motherboard for my laptop (if possible). Here are the specifications of my laptop: Model--> 15 number - e052se Product number--> E0Y23EA #ABV Operating systemWindows 8 64-bit language CENTRAL PROCESSING UNIT Intel Core i