3 Replies Latest reply on Aug 27, 2013 7:01 AM by Michael L Hale

    Generating an alpha channel for document

    EnsilZah Level 1

      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.

        • 1. Re: Generating an alpha channel for document
          c.pfaffenbichler Level 9

          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 );

          1 person found this helpful
          • 2. Re: Generating an alpha channel for document
            EnsilZah Level 1

            Thanks.

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

            • 3. Re: Generating an alpha channel for document
              Michael L Hale Level 5

              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.