{Carrer web log} ←
Make Photoshop Guides Grid with JavaScript
Thursday, November 03, 2011 { 4 Comments }
Last week I published "Draw Shapes in Photoshop with JavaScript" and I had lot of fun scripting in Photoshop. If you ever made Grid of Guides in Photoshop you know how painful and time costuming it is. I made two scripts that can help you speed up the process of making Guides Grid in Photoshop.The first script makes Unit Grid with vertical and horizontal units, you can also set the gutter. Example if you want to set 80px grid system with 20px gutter size. You can do MakeGuidesGrid(80,20,80,20); this will set the vertical and horizontal gutters, naturally you can set just vertical guides MakeGuidesGrid(80,20,0,0);
The Script on GitHub
Direct Download of this script
The second script doesn't use units but number of guides. So you can set number of vertical and horizontal guides and the gutter. Lets say you need 12 vertical guides and 10 horizontal guides with gutter of 15px. The function is MakeGuidesGrid(12,15,10,15);
The Script on GitHub
Direct Download of this script
How to use this script.
Download and copy the scripts GuidesUnitGrid.js and NumberGuidesGrid.js inside Photoshop > Presets > Scripts [Folder]
Then you need to go to open Photoshop and than File > Scripts > Browse find the script (where you previously copied it) and click Open.
Dialog box will popup asking the info about the unit size or number of guides or gutter size you need to put just the your numbers inside. And that is it.
Works only in Photoshop CS5 and later. Make sure that the guides are checked View > Show > Guides. To delete the Guides you do View > Clear Guides .
If you have any questions let me know in the comments.
4 Responses to “Make Photoshop Guides Grid with JavaScript”
- // m2 // 11/07/2011
- // Vladimir // 11/08/2011
- // // 2/11/2013
-
// Unknown
// 1/20/2016
Thanks for the script, very useful. Made a slight tweak because I justed wanted to say 'gimme a 10x10 grid please' instead of pixel coordinates, and have attached modified version below incase it's useful to anyone.
// Prompt user for grid dimensions
var dimension = GetDimension();
// Verify input is correct (a number and between 2 and 100)
while(isNaN(dimension) || dimension < 2 || dimension > 100)
{
if(dimension == null) break; // If user entered nothing then just stop looping and let them exit
alert("Please enter a number in the range of 2 to 100"); // Show error message
dimension = GetDimension(); // Re-prompt user for grid dimensions until they enter correct dimensions, or null (nothing)
}
// If received valid input, create grid now
if(dimension != null) MakeGrid(dimension);
// Get grid dimension from user
function GetDimension()
{
return prompt("How many spaces should the grid have?", 10, "Guide Grid "+activeDocument.name);
}
// Function to create both x and y guides
function MakeGrid(dimension)
{
MakeGuides(dimension, app.activeDocument.width, Direction.HORIZONTAL);
MakeGuides(dimension, app.activeDocument.height, Direction.VERTICAL);
}
// Function to actually create guids
function MakeGuides(total, area, direction)
{
spacing = area / total;
for (var i = 1; i < total; i++)
{
app.activeDocument.guides.add(direction, i * spacing);
}
}
<< Home
About Me <<<
Name: Vladimir Carrer
vladocar [at] gmail.com
Location: Verona, Italy
I'm a web designer, developer, teacher, speaker, generally web addicted ...
My projects <<<
- AI Prompt Directory
- Hand Drawn Icons
- Font Design Inspiration
- Font Pairings
- Free SVG Cut File
- Upcoming NFT projects
- Discord Tutorials
- Free Sublimation Designs
- Tech Feed
- MySQL Lite Administrator
- Quark Mini PHP CMS
- Formy - CSS Form Framework
- Emastic - CSS Framework
- Malo - CSS Library
- The Golden Grid
- 1 line CSS Grid Framework
- Two Lines CSS Framework
- Child Selector System - CSS Framework
- Better Web Readability Project
- Azbuka - CSS Typographical Base Rendering Library
- ClipR - bookmarklet for better reading
- CSS3 Action Framework
- CSS Mini Reset
- HTML5 Mini Template
- CSS Mobile Reset
- picoCSS - JavaScript Framework
- HTML Lorem Ipsum Crash Test
- Object Auto Documentation - JavaScript
- o - JS Library for Object Manipulation
- Foxy - CSS Framework
- Tumblr Free Theme - Better Readability Project
- Box - CSS Framework
- SMART CSS GRID
- nanoJS - Minimal JS DOM Library
- Flexy CSS Framework
- Katana is CSS Layout System made with Flexbox
- Micro CSS Reset
- 60 Grid System
- Simple CSS Button
- ramd.js JavaScript library for making web applications.
- Minimal Notes web app build with Vue.js
- Scribble Font for Prototyping & Wireframing
- Flex One - 1 CSS Class System
- Floaty - CSS Float Based Layout System
- Infinity CSS Grid
- CLI Convert websites into readable PDFs
- keywords-extract - CLI tool, extract keywords from any web page.
- screenshoteer - Make website screenshots and mobile emulations from the command line.
- Basic.css - Classless CSS Starter File
§§Previous Posts <<<
- Draw Shapes in Photoshop with JavaScript
- Initiative - provide JSON and JSONP RSS Feeds
- Photoshop Wireframing Kit
- Using JavaScript Objects for storing data
- o - JS Library for Object Manipulation
- Few words about CSS LINT
- Foxy - CSS Framework
- Multiple object extend pattern in JavaScript
- Object Auto Documentation - JavaScript
- HTML Lorem Ipsum Crash Test
Other Profiles <<<
Content is licensed under a Creative Commons Public Domain License