Skip to main content
Inspiring
Aug 27, 2013 9:21 AM UTC
Question

Generating an alpha channel for document

Hi.

I'm trying to generate an alpha channel based on the transparency of all the layers in the document.

I usually do this manually by going into Image->Calculations, selecting Transparency in the Merged layer's channel and setting the blending mode to normal.

However, I can't find a way to invoke the calculations window and it won't record in ScriptListener.

So can someone please help me with invoking the function with these specific options or suggest another way of doing this?

For now I've done this by merging the layers and selecting the transparency of the resulting layer but I would rather keep the layers as they are and avoid unnecessary calculations.

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

c.pfaffenbichler
Community Expert
Community Expert
Aug 27, 2013 12:54 PM UTC

it won't record in ScriptListener.

It looks like it does for me in CS6.

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

var idMk = charIDToTypeID( "Mk  " );

    var desc7 = new ActionDescriptor();

    var idNw = charIDToTypeID( "Nw  " );

    var idChnl = charIDToTypeID( "Chnl" );

    desc7.putClass( idNw, idChnl );

    var idUsng = charIDToTypeID( "Usng" );

        var desc8 = new ActionDescriptor();

        var idT = charIDToTypeID( "T   " );

            var ref5 = new ActionReference();

            var idChnl = charIDToTypeID( "Chnl" );

            var idChnl = charIDToTypeID( "Chnl" );

            var idTrsp = charIDToTypeID( "Trsp" );

            ref5.putEnumerated( idChnl, idChnl, idTrsp );

            var idLyr = charIDToTypeID( "Lyr " );

            var idOrdn = charIDToTypeID( "Ordn" );

            var idMrgd = charIDToTypeID( "Mrgd" );

            ref5.putEnumerated( idLyr, idOrdn, idMrgd );

        desc8.putReference( idT, ref5 );

        var idSrctwo = charIDToTypeID( "Src2" );

            var ref6 = new ActionReference();

            var idChnl = charIDToTypeID( "Chnl" );

            var idChnl = charIDToTypeID( "Chnl" );

            var idRd = charIDToTypeID( "Rd  " );

            ref6.putEnumerated( idChnl, idChnl, idRd );

        desc8.putReference( idSrctwo, ref6 );

    var idClcl = charIDToTypeID( "Clcl" );

    desc7.putObject( idUsng, idClcl, desc8 );

executeAction( idMk, desc7, DialogModes.NO );

Translate
EnsilZahAuthor
Inspiring
Aug 27, 2013 1:03 PM UTC

Thanks.

I guess it doesn't work for me bacause I'm using the CS6 Listener in CC or something.

Translate
Inspiring
Aug 27, 2013 2:01 PM UTC

I also use the CS6 plug-in with CC and it records for me so I don't think that is the reason. Did you have ESKT running when you tried to record? I have noticed that ESKT seems to check the connection to Photoshop( or something like that ) every few seconds or so and that can interfere with scriptlistener among other things. I try to not have ESKT running when I need scriptlistner output. If it is running sometimes you have to try several times before it show in the log.

Translate