Ruler guides in Photoshop are essential for maintaining consistency and accuracy in your designs. They help align elements, create grids, and establish visual hierarchies. However, manually recreating these guides across multiple documents can be time-consuming. This guide explores various methods for How To Copy Ruler Guides In Photoshop, streamlining your workflow and ensuring design uniformity.
Understanding Ruler Guides in Photoshop
Before diving into the copying methods, let’s clarify what ruler guides are and why they’re useful. Ruler guides are non-printing lines that you can drag from the horizontal and vertical rulers in Photoshop. They provide visual references for precise placement and alignment of design elements.
Alt text: Photoshop interface showing horizontal and vertical ruler guides on an open document.
Method 1: Using Scripts for Copying and Pasting Guides
One of the most efficient ways to copy ruler guides in Photoshop is by using scripts. These scripts automate the process, allowing you to quickly transfer guides between documents.
Script 1: Separate Copy and Paste Scripts
This method uses two separate scripts, one for copying guides and another for pasting them.
Copy Script:
/* https://www.reflections-ibs.com/blog/articles/how-to-copy-guides-from-one-photoshop-document-to-another https://www.reflections-ibs.com/media/1241/guides-copy.jsx */
#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;
setGuides();
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 );
};
Paste Script:
/* https://www.reflections-ibs.com/blog/articles/how-to-copy-guides-from-one-photoshop-document-to-another https://www.reflections-ibs.com/media/1242/guides-paste.jsx */
#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;
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 );
};
How to use:
- Save the scripts: Save each script as a
.jsx
file (e.g.,copy_guides.jsx
andpaste_guides.jsx
). - Install the scripts: In Photoshop, go to
File > Scripts > Browse...
and select the script file. Alternatively, you can place the script files in the Photoshop Scripts folder for easier access viaFile > Scripts
. - Copy Guides: Open the document containing the guides you want to copy and run the
copy_guides.jsx
script. - Paste Guides: Open the destination document and run the
paste_guides.jsx
script.
Script 2: Combined Copy and Paste Script
This script combines the copy and paste functionality into a single script. Holding down the SHIFT key while running the script will copy the guides. Running the script normally will paste the guides.
/* https://gist.github.com/codyjlandstrom/5fcb2779b59eb97d862311a2b2815791 https://youtu.be/ERHbxtyOJEg
NOTE: Hold down the shift key when copying guides */
#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();
app.beep();
} 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);
};
How to use:
- Save the script: Save the script as a
.jsx
file (e.g.,copy_paste_guides.jsx
). - Install the script: In Photoshop, go to
File > Scripts > Browse...
and select the script file. - Copy Guides: Open the document containing the guides you want to copy. Hold down the SHIFT key and then run the
copy_paste_guides.jsx
script. Photoshop will beep to indicate the guides have been copied. - Paste Guides: Open the destination document and run the
copy_paste_guides.jsx
script without holding down the SHIFT key.
Alt text: Screenshot of the Photoshop File > Scripts menu showing the location of installed scripts.
Method 2: Using Templates
Another approach is to create a template file containing the desired ruler guides. This method is particularly useful when you frequently use the same set of guides across multiple projects.
How to use:
- Create a new document: Create a new Photoshop document with the dimensions and resolution you typically use.
- Add the guides: Add the ruler guides you want to include in your template.
- Save as a template: Go to
File > Save As...
and choose “Photoshop Template (*.potx)” as the file format. - Use the template: When starting a new project, open the template file. Photoshop will create a new document based on the template, preserving the ruler guides.
Method 3: Manually Copying Guides (Less Efficient)
While not as efficient as using scripts or templates, you can manually copy the guide positions and recreate them in another document.
How to use:
- Record guide positions: In the source document, carefully note the position (in pixels) of each horizontal and vertical guide. You can find this information by double-clicking the guide with the Move tool selected.
- Recreate guides: In the destination document, drag out new guides from the rulers and manually enter the recorded positions in the X and Y fields of the Options bar.
Choosing the Right Method
The best method for copying ruler guides in Photoshop depends on your specific needs and workflow.
- Scripts: Ideal for frequent copying between different documents with varying layouts.
- Templates: Best for projects that consistently use the same grid or guide system.
- Manual Copying: Suitable for occasional use when you only need to transfer a few guides.
Conclusion
Copying ruler guides in Photoshop is a crucial skill for maintaining consistency and efficiency in your design process. By utilizing scripts, templates, or manual techniques, you can streamline your workflow and ensure that your designs are accurately aligned and visually appealing. Choose the method that best suits your needs and start saving time on your next Photoshop project.