6 Replies Latest reply: Jun 6, 2012 7:53 AM by Paulo Skylar RSS

    Is there a way to copy guides from one photo to another?

    AudoWarp Community Member

      It would be very handy in determining movement between frames..

        • 1. Re: Is there a way to copy guides from one photo to another?
          c.pfaffenbichler Community Member

          I suppose a Scripting solution might be best to recreate guides in another image.

          • 2. Re: Is there a way to copy guides from one photo to another?
            AudoWarp Community Member

            I don't even know what "Scripting" is.

            That's probably a bad sign.....

            • 4. Re: Is there a way to copy guides from one photo to another?
              Paul Riggott Community Member

              Mmmm the problem here would be that the documents would have to be the same size, also Photoshop CS5 or better would be required.

               

              Here is an example script, save it to your Application presets/scripts folder. Restart Photoshop so it can pick up the new script.

              To use:

              Select the document with the guides you want to use, then File - Scripts select your script WITH the SHIFT key pressed.

              This will save the guides to memory.

              To use the guides on another document.. File - Scripts select your script.

               

               

              #target photoshop
              main();
              function main(){
              if(Number(app.version.match(/\d+/)) <12) return;
              if(!documents.length) return;
              var startRulerUnits = app.preferences.rulerUnits;
              app.preferences.rulerUnits = Units.PIXELS;
              if(ScriptUI.environment.keyboardState.shiftKey ){
                  setGuides();
                  }else{
                      displayGuides();
                      }
              app.preferences.rulerUnits = startRulerUnits;
              function setGuides(){
              var guides = app.activeDocument.guides;
              if(guides.length == 0){
                  alert("No guides exist");
                  return;
                  }
              var gH = '';
              var gV = '';
              for( var g = 0; g < guides.length; g++ ){
                  if(guides[g].direction.toString() == 'Direction.HORIZONTAL'){
                      gH+=(parseInt(guides[g].coordinate.value));
                      gH+=',';
                      }else{
                          gV+=(parseInt(guides[g].coordinate.value));
                          gV+=','
                          }
              }
              gH=gH.replace(/,$/,'');
              gV=gV.replace(/,$/,'');
              currentGuides = 'Layer Guides' + "¬" + gH + "¬" + gV;
              var desc2 = new ActionDescriptor();
              desc2.putString(0, currentGuides.toSource()); 
              app.putCustomOptions('7a301ec0-afde-11e1-afa6-0800200c9a66', desc2, true );
              }
              function displayGuides(){
              try{
              var desc1 = app.getCustomOptions('7a301ec0-afde-11e1-afa6-0800200c9a66');
              var layerGuides = eval(desc1.getString(0));
                  }catch(e){return;}
              clearGuides();
              var ar1 = layerGuides.toString().split('¬');
              var Hor = ar1[1].toString().split(',');
              var Ver = ar1[2].toString().split(',');
              for(var H in Hor){
                  activeDocument.guides.add(Direction.HORIZONTAL,new UnitValue(Number(Hor[H]),'px'));
                  }
              for(var V in Ver){
                  activeDocument.guides.add(Direction.VERTICAL,new UnitValue(Number(Ver[V]),'px'));
                  }
              }
              }
              function clearGuides() { 
                 var id556 = charIDToTypeID( "Dlt " ); 
                     var desc102 = new ActionDescriptor(); 
                     var id557 = charIDToTypeID( "null" ); 
                         var ref70 = new ActionReference(); 
                         var id558 = charIDToTypeID( "Gd  " ); 
                         var id559 = charIDToTypeID( "Ordn" ); 
                         var id560 = charIDToTypeID( "Al  " ); 
                         ref70.putEnumerated( id558, id559, id560 ); 
                     desc102.putReference( id557, ref70 ); 
                 executeAction( id556, desc102, DialogModes.NO ); 
              };
              
              
              • 5. Re: Is there a way to copy guides from one photo to another?
                c.pfaffenbichler Community Member

                You are a Photoshop Scripting-champ!

                • 6. Re: Is there a way to copy guides from one photo to another?
                  Paulo Skylar Community Member

                  A pretty basic way for doing a version of what you ask is to open up both your reference image (psd), the one with the guides, and your new test image. Then drag your test image into the reference image and you will now see the guides and your test image. This, of course, can be done with many images each on its own layer. Toggling the test image visibility ON 7 Off will also possibly let you "see" any movement.

                   

                  As with the elegant scripting solution, you need images of the same size  to get meaningful measurements. Also, when you drop the test image into the reference image file make sure the shift key is pressed so you will get exact registration between the two images.

                   

                  Paulo