11 Replies Latest reply: Feb 28, 2012 10:47 AM by ericgraig RSS

    Slicing an image

    ericgraig Community Member

      For a project I am working on, I would be like to be able to slice a photograph up into a number of smaller segments. I can explain what I want to do best in terms of what this would look like if I were working with a physcial print.  Let's say the print is 8 X 10 inches.  I'd like to take that print and cut it up into 16 half inch strips along the 8 inch side, and then cut those horizontally into 20 half inch little squares.  It would sort of resemble a jigsaw puzzle but of course all the side would be straight.  Is there a convenient way to do this in photoshop? I'd want to be able to remove these and rearrange them in PS or perhaps paste each segment into inDesign or Quark.

       

      Thanks.

        • 1. Re: Slicing an image
          Noel Carboni Community Member

          Have you looked into Photoshop's Slice feature?  Generally speaking, it's oriented toward web publishing, where a web page is comprised of multiple parts that make up a whole, and you would use Save For Web & Devices to save the document as multiple images, each of which contains a part of the whole.  Not sure if this matches up to what you're wanting to do.

           

          Another approach might be to select portions of your image, then use Cut/Paste to put those parts on different layers.

           

          -Noel

          • 2. Re: Slicing an image
            Mylenium CommunityMVP

            Depends on what you specifically have in mind. Tiled printing can be easily done from a PDF and/ or set up accordingly in ID. Just the same, if you plan additional layout work in ID or Quark, then there's no need to bother at all to slice the files - placing the same single image and positioning it differently inside multiple frames is a basic workflow and I'm sure with some automation/ a script in ID you could do this 500 times a day without ever having to do it manually....

             

            Mylenium

            • 3. Re: Slicing an image
              ericgraig Community Member

              I don't think slicing will work for a variety of reasons not the least of which it doesn't seem to allow one to specify the sizes of each slice.I sort of see what you're saying with placing the same image in different image frames and repositioning it within the frames but that's pretty much a manual process unless you're writing a script.  SOmething FAR outside of my capabilities.  Here is the starting image:

               

              Original.jpg

               

              Here is what I want to end with EXCEPT I want very small slices and more than that, I want to slice both vertically (as shown) and horizontally.

               

              Test.jpg

               

              This was done quickly with the selection tool.  The second image is comprised of four layers, one for each slice and one for the background. I will be buying either Quark or ID in the next couple of days so I can do this in either of those if that would be best.

               

              Thanks,

               

              Eric

              • 4. Re: Slicing an image
                Noel Carboni Community Member

                What's your intent with the pieces?  Are you going to be printing them separately?

                 

                -Noel

                • 5. Re: Slicing an image
                  ericgraig Community Member

                  No. I want them all on a single sheet.

                  • 6. Re: Slicing an image
                    Noel Carboni Community Member

                    Can you not just draw white rectangles over them, much as you've done above?  I'm just not seeing the problem.

                     

                    -Noel

                    • 7. Re: Slicing an image
                      ericgraig Community Member

                      I can't for two reasons: First, to draw over them would be to obscure part of the image.  Second, all these rectangles need to be prscisely positioned and there will be a ton of them. For a 16 X 16 inche image divided into 1/2 inch squares there will be 1024 individual squares.

                      • 8. Re: Slicing an image
                        Paul Riggott Community Member

                        You can do this with a script ...

                         

                         

                        #target photoshop
                        function main(){
                        var dlg=
                        "dialog{text:'Script Interface',bounds:[100,100,380,290],"+
                        "panel0:Panel{bounds:[10,10,270,180] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
                        "title:StaticText{bounds:[60,10,220,40] , text:'Tile Picture' ,properties:{scrolling:undefined,multiline:undefined}},"+
                        "panel1:Panel{bounds:[10,40,250,130] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
                        "statictext1:StaticText{bounds:[10,10,111,30] , text:'Accross' ,properties:{scrolling:undefined,multiline:undefined}},"+
                        "statictext2:StaticText{bounds:[140,10,230,27] , text:'Down' ,properties:{scrolling:undefined,multiline:undefined}},"+
                        "across:DropDownList{bounds:[10,30,100,50]},"+
                        "down:DropDownList{bounds:[140,30,230,50]}},"+
                        "button0:Button{bounds:[10,140,110,160] , text:'Ok' },"+
                        "button1:Button{bounds:[150,140,250,160] , text:'Cancel' }}};"
                        var win = new Window(dlg,'Tile Picture');
                        if(version.substr(0,version.indexOf('.'))>9){
                        win.panel0.title.graphics.font = ScriptUI.newFont("Arial","BOLD",20);
                        g = win.graphics;
                        var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 1.00, 1.00, 1]);
                        g.backgroundColor = myBrush;
                        var myPen =g.newPen (g.PenType.SOLID_COLOR, [1.00, 0.00, 0.00, 1],lineWidth=1);
                        }
                        win.center();
                          for(var i=1;i<41;i++){
                           win.panel0.panel1.across.add ('item', i);     
                           win.panel0.panel1.down.add ('item', i);     
                          }
                        win.panel0.panel1.across.selection=0;
                        win.panel0.panel1.down.selection=0;
                        var done = false; 
                            while (!done) { 
                              var x = win.show(); 
                              if (x == 0 || x == 2) {
                                win.canceled = true;
                                done = true; 
                              } else if (x == 1) { 
                                done = true; 
                                {
                        if(!documents.length)return;
                        var startRulerUnits = preferences.rulerUnits;
                        preferences.rulerUnits = Units.PIXELS;
                        doc = app.activeDocument;
                        app.displayDialogs = DialogModes.NO;
                        var tilesAcross = parseInt(win.panel0.panel1.across.selection.index)+1;
                        var tilesDown =parseInt(win.panel0.panel1.down.selection.index)+1;
                        var tileWidth = parseInt(doc.width/tilesAcross);
                        var tileHeight = parseInt(doc.height/tilesDown);
                        ProcessFiles(tilesDown,tilesAcross,tileWidth,tileHeight);
                        app.preferences.rulerUnits = startRulerUnits;      
                              } 
                           }
                          }
                        }
                        main();
                        function ProcessFiles(Down,Across,offsetX,offsetY){
                        activeDocument.flatten();
                        TLX = 0; TLY = 0; TRX = offsetX; TRY = 0;
                        BRX = offsetX; BRY = offsetY; BLX = 0; BLY = offsetY;
                         for(var a = 0; a < Down; a++){
                          for(var i = 0;i <Across; i++){
                                            doc.activeLayer = doc.artLayers.getByName("Background");
                            doc.selection.select([[TLX,TLY],[TRX,TRY],[BRX,BRY],[BLX,BLY]], SelectionType.REPLACE, 0, false); 
                                            executeAction(charIDToTypeID( "CpTL" ), undefined, DialogModes.NO );
                            doc.selection.deselect();
                            doc.activeLayer = doc.artLayers.getByName("Background");
                        TLX = offsetX * (i+1) ; TRX  = TLX + offsetX; BRX = TRX; BLX = TLX;  
                            }
                        TLX = 0; TLY = offsetY * (a +1); TRX = offsetX; TRY = offsetY * (a +1);
                        BRX = offsetX; BRY = TRY + offsetY; BLX = 0; BLY = (offsetY * (a +1)+offsetY); 
                         }
                        }
                        
                        
                        • 9. Re: Slicing an image
                          ericgraig Community Member

                          Well that is incredibly cool. Not only that, I actually got it to run.  Now, one last question... how can each of the layers this creates be saved as a separate file (in order to enable me to lay them out as I need to in ID or Quark)?

                           

                          Eric

                          • 10. Re: Slicing an image
                            Paul Riggott Community Member

                            You can use File - Scripts - Export Layers to Files

                            or my own...

                            http://www.scriptsrus.talktalk.net/Layer%20Saver.htm

                            • 11. Re: Slicing an image
                              ericgraig Community Member

                              Again, incredible.  I'm going to try your script.  I like the idea of being able to number the files according to my needs. Thanks again!

                               

                              Eric