7 Replies Latest reply on Aug 26, 2012 6:16 AM by musingistaken

    smoothing lasso tool on the fly?

    musingistaken Level 1

      hi,

       

      does anyone know if it is possible to smooth the sharp edges of a hand drawn lasso selection automatically?

       

      i know i can make a selection and then go to select>modify>smooth and it rounds off the selection, but i want to be able to do this on the fly as i make alot of selection in my artwork.

       

      maybe there is a filter to do the job?

       

      many thanks!

        • 1. Re: smoothing lasso tool on the fly?
          c.pfaffenbichler Level 8

          How would a Filter be more convenient than Selection > Modify?

          Maybe you could explain your workflow better.

           

          Have you considered assigning a Keyboard Shortcut to »Smooth«? 

          • 2. Re: smoothing lasso tool on the fly?
            musingistaken Level 1

            sorry, i should have explained myself a bit better.

             

            i want the selection to smooth automaticially so i do not have to assign a keyboard shotcut.

             

            but in the mean time, i think the keyboard shortcut will be the way to go. many thanks!

            • 3. Re: smoothing lasso tool on the fly?
              c.pfaffenbichler Level 8

              Photoshop offers a way to link operations to certain events with Script Events Manager, but I’m not sure if the Lasso provides a proper event.

              Maybe you should also ask over at

              http://forums.adobe.com/community/photoshop/photoshop_scripting

               

              But keep in mind that if you were to add Selections to an active Selection triggering »Smooth« would be applied to the entirety of the Selection.

              • 4. Re: smoothing lasso tool on the fly?
                c.pfaffenbichler Level 8

                As far as I can tell one can create a Script that checks the selected Tool and performs a »Smooth« if a certain Tool is selected (like the Polygonal Lasso Tool).

                And this can be linked to the creation of a Selection via File > Scripts > Script Events Manager.

                But that would also apply the smoothing if one loaded a Selection from a Channel or Layer while the Tool is selected, so that seems too inspecific.

                • 5. Re: smoothing lasso tool on the fly?
                  c.pfaffenbichler Level 8

                  Dang, by checking the last HistoryState one can circumvent that.

                  So I guess one can indeed trigger Select > Modify > Smooth whenever one has created a Selection with the Polygonal Lasso Tool or the Lasso Tool …

                  • 6. Re: smoothing lasso tool on the fly?
                    c.pfaffenbichler Level 8

                    If I understand what you want to do correctly you could try the following:

                     

                    Paste this code into a new jsx-file in ExtendScript Toolkit and save it into Photoshop’s Presets/Scripts-folder as »smoothLasso.jsx«.

                    // smooth selection if polygonal lasso or lasso tool is selected;
                    // 2012, use it your own risk;
                    #target photoshop
                    function getCurrentTool() {
                    var ref = new ActionReference(); 
                    ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
                    return typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID('tool')));
                    };
                    // check historystae and tool;
                    var theStates = app.activeDocument.historyStates;
                    var theState = String(theStates[theStates.length - 1]);
                    var theTool = getCurrentTool();
                    // if the considtions are met invoke smooth;
                    if (theTool == "polySelTool" || theTool == "lassoTool") {
                    if (theState == "[HistoryState Polygonal Lasso]" || theState == "[HistoryState Lasso]") {
                    // =======================================================
                    var idSmth = charIDToTypeID( "Smth" );
                        var desc9 = new ActionDescriptor();
                        var idRds = charIDToTypeID( "Rds " );
                        var idPxl = charIDToTypeID( "#Pxl" );
                        desc9.putUnitDouble( idRds, idPxl, 12.000000 );
                    executeAction( idSmth, desc9, DialogModes.NO );
                    }
                    };
                    

                     

                    Then run this

                    #target photoshop
                    if (!app.notifiersEnabled) {app.notifiersEnabled = true};
                    if (app.notifiers.length > 0) {app.notifiers.removeAll()};
                    app.notifiers.add("setd", File(app.path+"/Presets/Scripts/smoothLasso.jsx"), "Chnl");
                    

                    from ESTK directly.

                     

                    Your Script Events Manager dialog should look something like this then:

                    scriptEventsManager.jpg

                    The Script would apply »Smooth« with 12px Sample Radius* when a Selection has been created with Lasso or Polygonal Lasso Tool.

                    But the Script would also be run anytime you create or change a Selection, so it might be a drag on performance.

                     

                    I doubt this procedure is a great idea.

                     

                    *) To use other values edit the number in the line

                    desc9.putUnitDouble( idRds, idPxl, 12.000000 );
                    

                    and to raise the dialog change the line

                    executeAction( idSmth, desc9, DialogModes.NO );
                    

                    to

                    executeAction( idSmth, desc9, DialogModes.ALL );
                    
                    • 7. Re: smoothing lasso tool on the fly?
                      musingistaken Level 1

                      hi c.pfaffenbichler,

                       

                      many thanks for all the advice. its holiday weekedn over her at the moment so i'll let you know how i get on ina few days.

                       

                      thanks again!