8 Replies Latest reply on Mar 20, 2013 10:46 AM by Michael L Hale

    Help with getting values of Hue Sat layer?

    Mark Ashton Level 1

      Hi,

       

      So i am using the following script to create a new hue sat adjustment layer and ask for the settings. My problem is that I want to set this one and then apply the exact same adjustments to several other images in a batch and I cannont find the variable where the info would be stored?

       

      This is the code;

       

      var idMk = charIDToTypeID( "Mk  " );
          var desc593 = new ActionDescriptor();
          var idnull = charIDToTypeID( "null" );
              var ref427 = new ActionReference();
              var idAdjL = charIDToTypeID( "AdjL" );
              ref427.putClass( idAdjL );
          desc593.putReference( idnull, ref427 );
          var idUsng = charIDToTypeID( "Usng" );
              var desc594 = new ActionDescriptor();
              var idType = charIDToTypeID( "Type" );
                  var desc595 = new ActionDescriptor();
                  var idpresetKind = stringIDToTypeID( "presetKind" );
                  var idpresetKindType = stringIDToTypeID( "presetKindType" );
                  var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
                  desc595.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
                  var idClrz = charIDToTypeID( "Clrz" );
                  desc595.putBoolean( idClrz, false );
              var idHStr = charIDToTypeID( "HStr" );
              desc594.putObject( idType, idHStr, desc595 );
          var idAdjL = charIDToTypeID( "AdjL" );
          desc593.putObject( idUsng, idAdjL, desc594 );
      executeAction( idMk, desc593, DialogModes.ALL );
      

       

       

      I am using photoshop cs5 on Windows.

       

      Alternatively if it would be easier to do the same thing with a vibrance layer as it only has two possible inputs I could probably make do with that.

       

      Any help would be apperciated!

       

      Thanks,

       

      Mark

        • 1. Re: Help with getting values of Hue Sat layer?
          Michael L Hale Level 5

          If all you want to do is use those settings later to create a new adjustment layer you can use the same techinque I showed in your post about saving levels adjustment settings. That is: store the descriptor returned by the first executeAction where the user enters the settings and use that descriptor later in a new executeAction.

          • 2. Re: Help with getting values of Hue Sat layer?
            Mark Ashton Level 1

            Hi Michael,

             

            Thanks for getting back to me. I thought that would be the case but I can't seem to figure out how to use the information. which descriptor do i need to use, desc594?

            • 3. Re: Help with getting values of Hue Sat layer?
              Paul Riggott Level 6

              The problem you are having is that the newer versions of Photoshop do not return the details you want, this is where CS3 comes in handy...

               

               

              function hueSat() {
              var desc2 = new ActionDescriptor();
              var ref1 = new ActionReference();
              ref1.putClass( charIDToTypeID('AdjL') );
              desc2.putReference( charIDToTypeID('null'), ref1 );
              var desc3 = new ActionDescriptor();
              var desc4 = new ActionDescriptor();
              desc4.putBoolean( charIDToTypeID('Clrz'), false );
              var list1 = new ActionList();
              var desc5 = new ActionDescriptor();
              desc5.putInteger( charIDToTypeID('H   '), 0 );
              desc5.putInteger( charIDToTypeID('Strt'), 0 );
              desc5.putInteger( charIDToTypeID('Lght'), 0 );
              list1.putObject( charIDToTypeID('Hst2'), desc5 );
              desc4.putList( charIDToTypeID('Adjs'), list1 );
              desc3.putObject( charIDToTypeID('Type'), charIDToTypeID('HStr'), desc4 );
              desc2.putObject( charIDToTypeID('Usng'), charIDToTypeID('AdjL'), desc3 );
              try{
              return executeAction( charIDToTypeID('Mk  '), desc2, DialogModes.ALL );
              }catch(e){}
              };
              var newHueSatDesc = hueSat();
              //create a new hue sat layer with previous settings..
              executeAction( charIDToTypeID('Mk  '), newHueSatDesc, DialogModes.NO );
              
              
              • 4. Re: Help with getting values of Hue Sat layer?
                Mark Ashton Level 1

                So does that mean it can't be done, or just that it will be very complicated to get?

                • 5. Re: Help with getting values of Hue Sat layer?
                  Michael L Hale Level 5

                  In newer versions those settings are stored as rawData in the key ''legacyContentData'' so you can only use the normal Action Manager methods to get the raw data. From there you have to create a custom data parser. It can be done, but there can be a lot of data. There is the Master, 3 additive, and 3 subtractive primaries. Each of those 7 groups can have 3 to 7 values. To top that off is there is any documentation on the ''legacyContentData'' structure I have been unable to find it.

                   

                  If you really want access to the values I can post some code that shows how to get the values. But, like with your curve layer request, it seems to me that it would be much easier to just store the entire descriptor. You don't want to edit an existing adjustment, you just want to recreate it in another document.

                  • 6. Re: Help with getting values of Hue Sat layer?
                    Mark Ashton Level 1

                    Yes that does sound like a lot of complicated work for something that you would have thought would be relatively simple.

                     

                    I really do apperciate your help though Michael, I only started leaning java for photoshop three months ago and it has been a rollercoaster of a ride! If it wasn't for people like you posting in these forums I wouldn't be half as far as I am!

                     

                    Thanks,

                     

                    Mark

                    • 7. Re: Help with getting values of Hue Sat layer?
                      Mikaeru69 Level 3

                      To top that off is there is any documentation on the ''legacyContentData'' structure I have been unable to find it.

                       

                      There is indeed no documentation on the ''legacyContentData'' structure per se; however, it appears that this structure contains raw (binary) data which is identical to the contents of the Adobe Photoshop HSL file (.ahu) you would obtain by saving the current settings as a hue/saturation preset from the Adjustments dialog. Not only is this file format actually documented in the Adobe Photoshop File Formats Specification document, but chances are that the same design may also apply to other types of adjustments (curves, etc.) although I haven't checked if this is really the case.

                       

                      HTH,

                       

                           --Mikaeru

                      • 8. Re: Help with getting values of Hue Sat layer?
                        Michael L Hale Level 5

                        it appears that this structure contains raw (binary) data which is identical to the contents of the Adobe Photoshop HSL file (.ahu)

                        That does seems to be the case and that is about how I came up with the parser I have for HSL and Curve adjustment layers. At the time I was working on those the only file format specs I could find from Adobe was from the Photoshop 6 release cycle.

                         

                        I am glad Adobe no longer is so restritive regarding the format specs.