9 Replies Latest reply: May 13, 2012 3:04 AM by emil emil RSS

    Divide layer into 4 quarters and trouble with marquee tool.

    amsb9903

      Help, please!!! Because I will be doing this often in the near future, I need to create an action to precisely divide a LAYER into 4 quarters, in order to easily create seamless patterns. I'm having trouble figuring out how to automate the placing of guides limited to the center points of the selected layer dimensions, as opposed to the entire image's dimensions. My second difficulty is in selecting the quarters; using the marquee tool, etc, the selection tool is NOT snapping to the guides, despite what I have the Snap To preferences set to. I need to select the pixels right up to the guide line so that I can select the "Make a new layer via cut" and then move the new layers in position to make a seamless tile. Right now, it is selecting a few pixels off. (Annoying!) So until I can figure out how to address these issues, I can't even begin to record an action. Even if I can't record a general action, due to the problem of different layers having different dimensions, I'd be happy to discover a shortcut to accurately quartering a layer and any advice as to why I'm having trouble managing the marquee tool. Maybe I'll get lucky and some kind soul will have already created and be willing to share something to solve this problem I'm currently trying out the CS6 Beta but usually work in either CS5 or PSE 9. For those of you who respond, thanks in advance!

        • 1. Re: Divide layer into 4 quarters and trouble with marquee tool.
          c.pfaffenbichler Community Member

          If you want to give a Script a try, paste the following text into a new file in ExtendScript Toolkit (part of Photoshop’s installation, Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CS4 or /Applications/Utilities/Adobe Utilities-CS5/ExtendScript Toolkit CS5) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

          After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action, (in CS4 and CS5) be used in a Configurator-Panel or started from ExtendScript Toolkit directly.

           

          // make 4 quadrant copiers of selected layer;

          // 2012, use at your own risk;

          #target photoshop

          if (app.documents.length > 0) {

          var myDocument = app.activeDocument;

          var originalUnits = app.preferences.rulerUnits;

          app.preferences.rulerUnits = Units.PIXELS;

          //

          var theLayer = myDocument.activeLayer;

          var theBounds = theLayer.bounds;

          var theWidth = theBounds[2] - theBounds[0];

          var theHeight = theBounds[3] - theBounds[1];

          // operation;

          var hor = 0;

          var ver = 0;

          for (var m = 0; m < 4; m++) {

          myDocument.activeLayer = theLayer;

          // calculate stuff;

          var left = theBounds[0] + (theWidth / 2 * hor);

          var right = left + (theWidth / 2);

          hor++;

          if (hor == 2) {hor = 0};

          var top = theBounds[1] + (theHeight / 2 * ver);

          var bottom = top + (theHeight / 2);

          if (String(m / 2).indexOf(".") != -1) {ver++};

          // make selection;

          var theArray = [[left, top], [right, top], [right, bottom], [left, bottom]];

          myDocument.selection.select(theArray, SelectionType.REPLACE, 0, false);

          // copy to layer;

          var id14 = charIDToTypeID( "CpTL" );

          executeAction( id14, undefined, DialogModes.NO );

          myDocument.activeLayer.name = theLayer.name + "_" + String(m);

          };

          // reset;

          app.preferences.rulerUnits = originalUnits;

          };

          • 2. Re: Divide layer into 4 quarters and trouble with marquee tool.
            emil emil Community Member

            amsb9903 wrote:

             

            Help, please!!! Because I will be doing this often in the near future, I need to create an action to precisely divide a LAYER into 4 quarters, in order to easily create seamless patterns...

            If your Photoshop has the 3D capabilities, for seamless patterns, try New Tiled Painting form the 3D menu.

            • 3. Re: Divide layer into 4 quarters and trouble with marquee tool.
              amsb9903

              Thank you so much, c.pfaffenbichler , that worked like a charm! I thought I would have to use a script but have never worked with them and was at a complete loss. You saved me a boat load of time!


              • 4. Re: Divide layer into 4 quarters and trouble with marquee tool.
                amsb9903

                Also, thank you emil emil for that idea. I haven't dealt much with the 3D tools yet but will definitely read up on that option. Much appreciated for bringing it to my attention!

                • 5. Re: Divide layer into 4 quarters and trouble with marquee tool.
                  emil emil Community Member

                  It takes a few seconds to try the New Tiled Painting and you don't need to read anything about it until you don't understand something. Personally I have never read about it - I just tried it when I saw it on that menu and after that have used it many times without a problem.

                   

                  1 create a new document with the size of the pattern.

                  2 choose 3D > New Tile Painting

                  3 paint

                  • 6. Re: Divide layer into 4 quarters and trouble with marquee tool.
                    amsb9903

                    What do you think I should do to activate that option in the 3D menu? I've set up a new document and dragged that layer into it but the 3D menu items are still greyed out. Should I change the mode? I've been working in RGB. Honestly, it might be a silly idea, but I really haven't messed with the 3D options before.What do you think I should do to activate that option in the 3D menu? I've set up a new document and dragged that layer into it but the 3D menu items are still greyed out. Should I change the mode? I've been working in RGB. Honestly, it might be a silly idea, but I really haven't messed with the 3D options before.

                    • 7. Re: Divide layer into 4 quarters and trouble with marquee tool.
                      emil emil Community Member

                      amsb, did you try the three steps in my previous post? Here's the steps again a little bit more specific,

                       

                      1. Choose File > New, and in the New dialog, from the Preset menu, choose let's say the Web preset, and press OK.

                      2. try choosing 3D > New Tile Painting and let me know if it is still grayed out. If not select it and

                      3 pick the brush tool and paint

                       

                      Let me know if you can do this first and then we will try to figure out why the menu was grayed out.

                      • 8. Re: Divide layer into 4 quarters and trouble with marquee tool.
                        amsb9903

                        emil emil  I now know what the problem is. 3D functionality is not available because Open GL Drawing is disabled. I would need to update my driver and adjust my preferences to use the graphics processor. As I'm working on my backup netbook at the moment, I won't worry about it for now. This little guy can't handle it. When I get my "good" computer up and running again, I'll try your method. For now, the script allows me to easily make a repeating pattern tile, so I'm content! Thank you so much for your helpful suggestions and I can't wait to try this out in the future.

                        • 9. Re: Divide layer into 4 quarters and trouble with marquee tool.
                          emil emil Community Member

                          I thought about the Open GL before I posted my previous reply but I made a test on my computer with Open GL disabled and the New Tile Painting was still available in my 3D menu and everything was still working fine. If it is your video card,  I guess my Quadro fx workstation video card made it work even with Open GL disabled.