1 Reply Latest reply: Mar 14, 2014 2:27 AM by Mattmcquiff RSS

    Resize a smart object by 'point'

    Mattmcquiff Community Member

      I have a pattern that has a logo 253px x 253px in the top left corner it won't repeat until 9000 px on the x and y axis.

       

      Then I have an action. that runs in this order

       

       

      Image Size Width 1000 points (no resampling)

      new layer

      then Fill pattern, this places the logo in the top right hand corner.

      convert to smart object.

      then transform object

       

      Here I have the issue that even though I change the size by points in the top bar, it defaults to a percentage in the action.

      If it changed size by the points it could be enlarged or shrunk relatice to the main image.

       

      I'm thinking it may have to be scripted?

      Matt

        • 1. Re: Resize a smart object by 'point'
          Mattmcquiff Community Member

          This is a script of the action

           

          #target photoshop

          //

          // Sticker Placer.jsx

          //

           

           

          //

          // Generated Fri Mar 14 2014 09:13:41 GMT-0000

          //

           

           

          cTID = function(s) { return app.charIDToTypeID(s); };

          sTID = function(s) { return app.stringIDToTypeID(s); };

           

           

          //

          //==================== Sticker Placer ==============

          //

          function Action7() {

                // Image Size

            function step1(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              desc1.putUnitDouble(cTID('Wdth'), cTID('#Rlt'), 1020);

              executeAction(sTID('imageSize'), desc1, dialogMode);

            };

           

           

            // Make

            function step2(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var desc2 = new ActionDescriptor();

              desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 27);

              desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Vrtc'));

              desc1.putObject(cTID('Nw  '), cTID('Gd  '), desc2);

              executeAction(cTID('Mk  '), desc1, dialogMode);

            };

           

           

            // Make

            function step3(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var desc2 = new ActionDescriptor();

              desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 29);

              desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Hrzn'));

              desc1.putObject(cTID('Nw  '), cTID('Gd  '), desc2);

              executeAction(cTID('Mk  '), desc1, dialogMode);

            };

           

           

            // Make

            function step4(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var desc2 = new ActionDescriptor();

              desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 280);

              desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Vrtc'));

              desc1.putObject(cTID('Nw  '), cTID('Gd  '), desc2);

              executeAction(cTID('Mk  '), desc1, dialogMode);

            };

           

           

            // Make

            function step5(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var desc2 = new ActionDescriptor();

              desc2.putUnitDouble(cTID('Pstn'), cTID('#Rlt'), 282);

              desc2.putEnumerated(cTID('Ornt'), cTID('Ornt'), cTID('Hrzn'));

              desc1.putObject(cTID('Nw  '), cTID('Gd  '), desc2);

              executeAction(cTID('Mk  '), desc1, dialogMode);

            };

           

           

            // Make

            function step6(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var ref1 = new ActionReference();

              ref1.putClass(cTID('Lyr '));

              desc1.putReference(cTID('null'), ref1);

              executeAction(cTID('Mk  '), desc1, dialogMode);

            };

           

           

            // Set

            function step7(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var ref1 = new ActionReference();

              ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));

              desc1.putReference(cTID('null'), ref1);

              var desc2 = new ActionDescriptor();

              desc2.putString(cTID('Nm  '), "Sticker");

              desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);

              executeAction(cTID('setd'), desc1, dialogMode);

            };

           

           

            // Set

            function step8(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var ref1 = new ActionReference();

              ref1.putProperty(cTID('Chnl'), sTID("selection"));

              desc1.putReference(cTID('null'), ref1);

              var desc2 = new ActionDescriptor();

              desc2.putUnitDouble(cTID('Top '), cTID('#Rlt'), 0);

              desc2.putUnitDouble(cTID('Left'), cTID('#Rlt'), 0);

              desc2.putUnitDouble(cTID('Btom'), cTID('#Rlt'), 324);

              desc2.putUnitDouble(cTID('Rght'), cTID('#Rlt'), 326);

              desc1.putObject(cTID('T   '), cTID('Rctn'), desc2);

              executeAction(cTID('setd'), desc1, dialogMode);

            };

           

           

            // Fill

            function step9(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var desc2 = new ActionDescriptor();

              desc2.putUnitDouble(cTID('Hrzn'), cTID('#Rlt'), 0);

              desc2.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), 0);

              desc1.putObject(cTID('From'), cTID('Pnt '), desc2);

              desc1.putInteger(cTID('Tlrn'), 32);

              desc1.putEnumerated(cTID('Usng'), cTID('FlCn'), cTID('Ptrn'));

              var desc3 = new ActionDescriptor();

              desc3.putString(cTID('Nm  '), "sticker.tif");

              desc3.putString(cTID('Idnt'), "56e0a18a-eb55-1176-97d3-fe60e1fab27c");

              desc1.putObject(cTID('Ptrn'), cTID('Ptrn'), desc3);

              desc1.putBoolean(cTID('Cntg'), false);

              executeAction(cTID('Fl  '), desc1, dialogMode);

            };

           

           

            // Set

            function step10(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              var ref1 = new ActionReference();

              ref1.putProperty(cTID('Chnl'), sTID("selection"));

              desc1.putReference(cTID('null'), ref1);

              desc1.putEnumerated(cTID('T   '), cTID('Ordn'), cTID('None'));

              executeAction(cTID('setd'), desc1, dialogMode);

            };

           

           

            // Convert to Smart Object

            function step11(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              executeAction(sTID('newPlacedLayer'), undefined, dialogMode);

            };

           

           

            // Transform

            function step12(enabled, withDialog) {

              if (enabled != undefined && !enabled)

                return;

              var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

              var desc1 = new ActionDescriptor();

              desc1.putEnumerated(cTID('FTcs'), cTID('QCSt'), sTID("QCSCorner0"));

              var desc2 = new ActionDescriptor();

              desc2.putUnitDouble(cTID('Hrzn'), cTID('#Rlt'), 27);

              desc2.putUnitDouble(cTID('Vrtc'), cTID('#Rlt'), 29);

              desc1.putObject(cTID('Ofst'), cTID('Ofst'), desc2);

              desc1.putUnitDouble(cTID('Wdth'), cTID('#Rlt'), 253);

              desc1.putUnitDouble(cTID('Hght'), cTID('#Rlt'), 253);

              executeAction(cTID('Trnf'), desc1, dialogMode);

            };

           

           

           

           

            step1();      // Image Size

            step2();      // Make

            step3();      // Make

            step4();      // Make

            step5();      // Make

            step6();      // Make

            step7();      // Set

            step8();      // Set

            step9();      // Fill

            step10();      // Set

            step11();      // Convert to Smart Object

            step12();      // Transform

          };

           

           

           

           

           

           

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

          //                    Sticker PLacer.main

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

          //

           

           

          Action7.main = function () {

            Action7();

          };

           

           

          Action7.main();

           

           

          // EOF

           

           

          "Action7.jsx"

          // EOF