5 Replies Latest reply on Apr 26, 2013 3:42 AM by JJMack

    How to scale to fit Photoshop CS6

    Picturequest Level 1

      I work with a lot of texture layers, often the wrong size and dimensions. I do transform and manually resize. But is there a scale to fit command?In the Photoshop Paper Texture extension, you can see it does that automatically. If there isn't such a command, can anyone point me to an action I can use.

       

      Thank you.

       

      Max

        • 1. Re: How to scale to fit Photoshop CS6
          JJMack Most Valuable Participant

          Picturequest wrote:

           

          I work with a lot of texture layers, often the wrong size and dimensions.

          ???? I know you know what that statement means to you.  I have no idea though of what your trying to convey to us. Using "Photoshop Paper Texture extension" as a google search returns a single hit your thread. ???

          • 2. Re: How to scale to fit Photoshop CS6
            Picturequest Level 1

            Adobe provides an EXTENSION called Adobe Paper Textures. It is a panel that applies an image as a texture at random. Somewhere in its script? It sizes the texture to fit the image it is applied to. My point being, either natively, or via script, a layer can be resized to fit the dimension of the current document.

             

            My question was whether CS6 has a command "size to fit?" and if not, can someone point me to an action that can achieve that in one click.

            • 3. Re: How to scale to fit Photoshop CS6
              JJMack Most Valuable Participant

              I downloaded the panel did not install it for I do not like Photoshop panels where each version of Photoshop needs a different configurator, and extension manager and extension version.  But I did unzip the files there is one script and it has one  resize step basically it distorts the texture document so it has the same pixel size and resolution as the image document using bicubicsharper interpolation though the comment states just bicubic

               

               

              textureDoc.resizeImage( targetDoc.width, targetDoc.height, targetDoc.resolution, ResampleMethod.BICUBICSHARPER ); // ResampleMethod.BICUBIC );

              • 4. Re: How to scale to fit Photoshop CS6
                Picturequest Level 1

                Thank you for finding that. I'm guessing that would not work on a "targeted" layer just a Doc. Don't really know how to turn this into an action or script though.

                 

                So I'm guessing PS6 does not have such a scale to fit command.

                • 5. Re: How to scale to fit Photoshop CS6
                  JJMack Most Valuable Participant

                  No guessing needed of course there is. Layers are as easy to resize as documents is.  That is what "Transform" does in a script though its method name in script is resize. The resize values used are relative to current size percentage the anchor point defaults to the center but can be changed and the interpolation use is you interpolation preference which can be changed.

                  Javascript syntax

                  resize ([horizontal] [, vertical][, anchor]); // number number AnchorPosition

                  Resizes the layer to the specified dimensions (as a percentage of its current size) and places it in the specified position.

                   

                   

                  Here is a sample of how one might use it. You need to be careful if you have CS6 Adobe failed to update Photoshop scripting to support BicubicAutomatic and if you leave Adobe default interpolation preference set script will encounter a Photoshop internal error when you try to save that setting.

                   

                   

                  // Save interpolation settings the script will fail if CS6 and setting is bicubic automatic
                  var userResampleMethod = app.preferences.interpolation;
                  app.preferences.interpolation = ResampleMethod.BICUBIC; // resample interpolation bicubic
                  
                  
                  if (LWidth/LHeight<SWidth/SHeight) { // Smart Object layer Aspect Ratio less the Canvas area Aspect Ratio 
                     var percentageChange = ((SWidth/LWidth)*100); // Resize to canvas area width
                     activeDocument.activeLayer.resize(percentageChange,percentageChange,AnchorPosition.MIDDLECENTER);
                     }
                  else { 
                     var percentageChange = ((SHeight/LHeight)*100); // resize to canvas area height
                     activeDocument.activeLayer.resize(percentageChange,percentageChange,AnchorPosition.MIDDLECENTER);
                     }
                  
                  
                  app.preferences.interpolation = userResampleMethod; // Reset interpolation setting
                  
                  

                  Message was edited by: JJMack