8 Replies Latest reply on Nov 21, 2012 6:23 AM by JJMack

    "automatic sorting"

    boris_m25

      qHi!

       

      i wondering if this can be done easily. I have in the 80% of my pictures case where i have the same  size of pictures and i create grid 3x3 (14,50x9,67 cm). i create a action when i import the pictures to resample me every picture to this size (14,50x9,67 cm), after that i just move picture randomly in grid 3x3.

       

      So the big question is how to automatic sort pictures in 3x3 grid...

       

      https://www.dropbox.com/s/ru51h2umym2zlmy/295.jpg

        • 1. Re: "automatic sorting"
          c.pfaffenbichler Level 9

          Please post the image directly in the browser with the Insert Image button.

          cameraIconInsertImage.jpg

          • 4. Re: "automatic sorting"
            c.pfaffenbichler Level 9

            Paul Riggott has offered a Script for distributing Layers

            http://forums.adobe.com/message/4863226#4863226

            but it might not be a perfect fit here.

             

            What process exactly do you want to achieve?

            Select a folder or files, have them placed and arranged in an open document or a specific file on your hard drive, apply the Layer Styles, …?

             

            Have you checked out whether Contact Sheet II or Contact Sheet X might suffice for the task?

            http://ps-scripts.sourceforge.net/

             

            Edit: Ah, Paul has chimed in already anyway …

            • 5. Re: "automatic sorting"
              boris_m25 Level 1

              i need to import pictures scale on the exact mesure, after that arrange tham like is it in the picture...and use the predefined style...for this image i need aproximatly 30-60sec.

               

              Shift+ F11 (open blank document with grid)

              import 9 pictures (Shift+F3 predefined scale)

              Arrange tham 3x3

              Marquee tool take from one image background and resize it. And than just apply style.

               

               

              BTW one more question, when importing pictures can i avoid somehow presing the  "check mark" or "enter" to import the image

              • 6. Re: "automatic sorting"
                c.pfaffenbichler Level 9

                Have you given Paul’s Scripts a try yet?

                 

                I would recommend considering a different approach altogether, though.

                Create one sample file with nine placed Smart Objects, then use a Script to replace those and save as a new file.

                • 7. Re: "automatic sorting"
                  c.pfaffenbichler Level 9

                  For switching in images in an open file containing Smart Objects something like this might work.

                  // 2012, use at your own risk; 
                  #target photoshop
                  main();
                  ////// function //////
                  function main () {
                  var myDocument = app.activeDocument;
                  // get properties, thanks to xbytor;
                  var docName = myDocument.name;
                  if (docName.indexOf(".") != -1) {var baseName = docName.match(/(.*)\.[^\.]+$/)[1]}
                  else {var baseName = docName};
                  baseName = baseName.replace(new RegExp ("_[0-9]*$"), "");
                  // getting the location, if unsaved save to desktop;
                  try {var docPath = myDocument.path}
                  catch (e) {var docPath = "~/Desktop"};
                  // get smart objects;
                  var theLayers = collectSmartObjects(myDocument, []);
                  // select files;
                  if ($.os.search(/windows/i) != -1) {var theseFiles = File.openDialog ("please select files", '*.jpg;*.tif;*.pdf;*.psd', true)} 
                  else {var theseFiles = File.openDialog ("please select files", getFiles, true)};
                  if (theseFiles.length > 0) {
                  // psd options;
                  psdOpts = new PhotoshopSaveOptions();
                  psdOpts.embedColorProfile = true;
                  psdOpts.alphaChannels = true;
                  psdOpts.annotations = true;
                  psdOpts.layers = true; 
                  psdOpts.spotColors = true;
                  // insert the images in copies of the original file and count;
                  var theCounter = 0;
                  for (var n = 0; n < Math.ceil(theseFiles.length / theLayers.length); n++) {
                  // duplicate open image;
                  app.activeDocument = myDocument;
                  var theCopy = myDocument.duplicate(baseName);
                  // get the smart objects;
                  var theLayers = collectSmartObjects(theCopy, []);
                  // replace contents;
                  for (var m = 0; m < theLayers.length; m++) {
                            if (theCounter < theseFiles.length) {
                                      try {
                                                replaceContents(theLayers[m], theseFiles[theCounter]);
                                                }
                                      catch (e) {};
                                      theCounter++
                                      }
                            };
                  // get neighboring  psdf iles;
                  var theFiles = retrieveVariousFiles (Folder (docPath));
                  // collect numbers;
                  var theNumbers = new Array;
                  for (var m = 0; m < theFiles.length; m++) {
                            if (theFiles[m].name.match(new RegExp (baseName+"_"+"[0-9]*"+".psd")) ) {
                                      var thisNumber = Number(theFiles[m].name.slice(0, theFiles[m].name.length - 4).match(/\d*$/));
                                      theNumbers.push(thisNumber);
                                      }
                            };
                  // get largest number;
                  if (theNumbers.length > 0) {
                  function sorter (a,b) {
                  if(a > b) return -1
                  if(a < b) return 1
                  return 0
                  };
                            var number = theNumbers.sort(sorter)[0];
                            var theNumber = bufferNumberWithZeros(number + 1, 3)
                            }
                  else {
                            var theNumber = "001"
                            };
                  // save;
                  theCopy.saveAs((new File(docPath+"/"+baseName+"_"+theNumber+".psd")),psdOpts,false);
                  }
                  };
                  };
                  ////// function collect all smart object layers //////
                  function collectSmartObjects (theParent, allLayers) {
                            if (!allLayers) {var allLayers = new Array} 
                            else {};
                            for (var m = theParent.layers.length - 1; m >= 0;m--) {
                                      var theLayer = theParent.layers[m];
                  // apply the function to layersets;
                                      if (theLayer.typename == "ArtLayer") {
                                                if ( theLayer.kind == LayerKind.SMARTOBJECT) {allLayers.push(theLayer)}
                                                }
                                      else {
                                                allLayers = (collectSmartObjects(theLayer, allLayers))
                                                }
                                      };
                            return allLayers
                            };
                  ////// replace contents //////
                  function replaceContents (theSO, theFile) {
                  app.activeDocument.activeLayer = theSO;
                  // =======================================================
                  var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );
                      var desc5 = new ActionDescriptor();
                      var idnull = charIDToTypeID( "null" );
                      desc5.putPath( idnull, new File( theFile ) );
                  executeAction( idplacedLayerReplaceContents, desc5, DialogModes.NO );
                  return app.activeDocument.activeLayer
                  };
                  ////// get psds, tifs and jpgs from files //////
                  function getFiles (theFile) {
                      if (theFile.name.match(/\.(jpg|tif|psd|pdf|)$/i)) {
                          return true
                          };
                            };
                  ////// buffer number with zeros //////
                  function bufferNumberWithZeros (number, places) {
                            var theNumberString = String(number);
                            for (var o = 0; o < (places - String(number).length); o++) {
                                      theNumberString = String("0" + theNumberString)
                                      };
                            return theNumberString
                            };
                  ////// get from subfolders //////
                  function retrieveVariousFiles (theFolder, theFiles) {
                            if (!theFiles) {var theFiles = []};
                            var theContent = theFolder.getFiles();
                            for (var n = 0; n < theContent.length; n++) {
                                      var theObject = theContent[n];
                                      if (theObject.name.slice(-4) == ".psd") {
                                                theFiles = theFiles.concat(theObject)
                                                }
                                      };
                            return theFiles
                            };
                  
                  • 8. Re: "automatic sorting"
                    JJMack Most Valuable Participant

                    What you want to do is very easy to do with Photo Collage Templates and Photoshop Scripts.  Video demo of a collage template being populated. Any image file format size and resolution can be used. However collages that have image areas with aspect ration that closely match images aspect ratios work best. http://www.mouseprints.net/old/dpr/PopulateCollage.html My free Photoshop packages can be downloaded from the following link http://www.mouseprints.net/Photoshop.html  check out Photo Collage Toolkit.