Skip to content

Instantly share code, notes, and snippets.

@takuma7
Forked from jameswburke/ps-grid-generator.jsx
Created November 6, 2012 06:43
Show Gist options
  • Select an option

  • Save takuma7/4023076 to your computer and use it in GitHub Desktop.

Select an option

Save takuma7/4023076 to your computer and use it in GitHub Desktop.
Photoshop Script - Generate Grid Guides
//Modified version of sprite-grid.jsx by Filip Van Tendeloo
//Fixed for earlier versions of Photoshop based on guideLine function from
//http://www.ps-scripts.com/bb/viewtopic.php?f=9&t=3493&start=0
//None of this code is mine
// check for document
if(app.documents.length > 0){
// get active document
var psDoc = app.activeDocument;
// get user input on column count
var colWidth = parseInt( prompt("Column size?", 5) );
var docWidth = psDoc.width.as('px');
// determine number of columns
var colCount = docWidth / colWidth;
// create vertical guidelines
for(i = 0; i <= colCount; ++i){
guideLine(i * colWidth, 'Vrtc');
}
var docHeight = psDoc.height.as('px');
// determine number of rows
var rowCount = docHeight / colWidth;
// create horizontal rows
for(i = 0; i <= rowCount; ++i){
//psDoc.guides.add(Direction.HORIZONTAL, i * colWidth);
guideLine(i * colWidth, 'Hrzn');
}
}
function guideLine(position, type) {
var id296 = charIDToTypeID( "Mk " );
var desc50 = new ActionDescriptor();
var id297 = charIDToTypeID( "Nw " );
var desc51 = new ActionDescriptor();
var id298 = charIDToTypeID( "Pstn" );
var id299 = charIDToTypeID( "#Pxl" );
desc51.putUnitDouble( id298, id299, position );
var id300 = charIDToTypeID( "Ornt" );
var id301 = charIDToTypeID( "Ornt" );
var id302 = charIDToTypeID( type );
desc51.putEnumerated( id300, id301, id302 );
var id303 = charIDToTypeID( "Gd " );
desc50.putObject( id297, id303, desc51 );
executeAction( id296, desc50, DialogModes.NO );
};
@AnnaStyvenson
Copy link
Copy Markdown

Manchmal hat man Ideen im Kopf, aber weiß nicht genau, wie man sie umsetzt. Genau da helfen solche Tools, weil sie den Einstieg viel einfacher machen. bilder mit ki erstellen gibt dir eine Richtung, ohne dass du alles selbst ausdenken musst. Das fühlt sich entspannter an und nimmt den Druck raus. Man probiert einfach aus und schaut, was passiert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment