2 Replies Latest reply on Mar 27, 2017 8:39 AM by RebaMcEntire

    JSX solution to clear Pantone info from a spot channel?

    RebaMcEntire

      I have some files I need to strip Pantone info from the spot channels but keep a similar color in it's place.

      Say Pantone Blue or Pantone 301 would show up as an equivalent RGB blue.

       

      These are almost all grayscale files with anywhere from 2 - 20 color channels.

       

      I also need to iterate down the channel list and rename everything in order numerically ie. CLR1,CLR2,CLR3.

      I have this part figured out, but I can't find any info on how to strip the Pantone info from the channel.

      Just to clarify I'm not talking about the channel name. I'm talking about when you double click on the channel and the

      'Spot Channel Options' window pops up.

       

      I've tried changing ChannelType.SELECTEDAREA to see if it would reset it, but that throws an error whenever it hits a Pantone color.

       

      I thought maybe I could duplicate the channel in another new channel and pull the color info from the original channel

      but that doesn't seem to work either as I can't get the color info from the Pantone channel, it throws an error as well. Works fine on other channels:

      ColorR = docRef.channels[i].color.rgb.red;
      ColorG = docRef.channels[i].color.rgb.green;
      ColorB = docRef.channels[i].color.rgb.blue;
      

       

      Error: "Error 8366: This version of the ScriptingSupport does not support custom colors such as PANTONE® colors."

       

      Hopefully someone has experience with this and can give me some ideas, or point me to some info.

       

      Thanks!

        • 1. Re: JSX solution to clear Pantone info from a spot channel?
          Stephen_A_Marsh Adobe Community Professional

          I can’t directly help with scripting…

           

          Looking into actions, an action can record the alteration of the Pantone Color Book Library source to a similar Lab colour value (say just chaning the b value from say 36 to 35 to force the Lab colour picker change to take effect).

           

          So then I fired up an older version of Photoshop that had the ScriptListener plug-in installed, the output is never pretty, however it does appear that the changing of the colour can be scripted (the new Lab values are L71 a49 b35, however only the b value was changed from the original colour book):

           

          var idsetd = charIDToTypeID( "setd" );
              var desc2 = new ActionDescriptor();
              var idnull = charIDToTypeID( "null" );
                  var ref2 = new ActionReference();
                  var idChnl = charIDToTypeID( "Chnl" );
                  var idOrdn = charIDToTypeID( "Ordn" );
                  var idTrgt = charIDToTypeID( "Trgt" );
                  ref2.putEnumerated( idChnl, idOrdn, idTrgt );
              desc2.putReference( idnull, ref2 );
              var idT = charIDToTypeID( "T   " );
                  var desc3 = new ActionDescriptor();
                  var idClr = charIDToTypeID( "Clr " );
                      var desc4 = new ActionDescriptor();
                      var idLmnc = charIDToTypeID( "Lmnc" );
                      desc4.putDouble( idLmnc, 71.000000 );
                      var idA = charIDToTypeID( "A   " );
                      desc4.putDouble( idA, 49.000000 );
                      var idB = charIDToTypeID( "B   " );
                      desc4.putDouble( idB, 35.000000 );
                  var idLbCl = charIDToTypeID( "LbCl" );
                  desc3.putObject( idClr, idLbCl, desc4 );
              var idSCch = charIDToTypeID( "SCch" );
              desc2.putObject( idT, idSCch, desc3 );
          executeAction( idsetd, desc2, DialogModes.NO );
          

           

           

          I’m guessing that some of the script listener code is probably garbage!

           

          If you have no other solution, you could script the creation of a new spot colour channel based on Lab rather than a Pantone Color Book Library and then apply image or calculations to copy the unwanted spot channel to the new spot channel and delete the original spot (then loop this through all remaining spots)… Not sure if you can script the naming of the channels based on the Lab values or capture their original Lab values.

           

          Good luck!

          • 2. Re: JSX solution to clear Pantone info from a spot channel?
            RebaMcEntire Level 1

            I think i can get this to work. Thanks!