Skip to content

Instantly share code, notes, and snippets.

View Arahnoid's full-sized avatar

Igor Grinchesku Arahnoid

  • Chernivtsi, Ukraine
View GitHub Profile
@Arahnoid
Arahnoid / toggleLayerType.js
Last active April 21, 2019 22:58 — forked from Lokno/toggleLayerType.js
[Toggle layers visibility ]Toggle visiblity of a certain kind of layer in photoshop #Photoshop
// Install by saving to PHOTOSHOP_DIRECTORY/Presets/Scripts
// Also works just by opening it with File->Open..
// Once installed, you can add an action to run it with a keyboard shortcut
// Open Actions window (Window->Actions)
// Click the "Create a New Action" Button (dog-eared paper icon)
// Choose the name of the action and the shortcut keys you want
// Click Record
// Select Insert Menu Item...
// Select File->Scripts->toggleLayerType
@Arahnoid
Arahnoid / gist:3425dbd0211cd2cb4cbc
Last active April 21, 2019 22:57 — forked from JakeRTFM/gist:6165876
[Get PNG from layers]Get PNG from layer in a group by hide/show one by one #Photoshop
main();
function main(){
var doc = activeDocument;
var docPath = activeDocument.path;
var marketApps = doc.layerSets.getByName("Group Name");
for(var a=0; a<marketApps.layers.length; a++){
//alert(marketApps.layers[a]);
@Arahnoid
Arahnoid / psextendscriptexample.js
Last active April 21, 2019 22:57 — forked from aral/psextendscriptexample.js
[Export multiple resolution images]Using ExtendScript to save out multiple resolution images from Photoshop (with unsharp mask) #Photoshop
/*
The original files are 960x319.
Image sizes to save:
* 800x266 - Retina for 480x320 resolution (400 logical pixel wide panel areas)
* 740x246 - Desktop and iPad
* 616x205 - Retina for 320x480 resolution (308 logical pixel wide panel areas)
* 400x133 - 480x320 resolution
* 308x102 - 320x480 resolution
@Arahnoid
Arahnoid / export.js
Last active April 21, 2019 22:59 — forked from nextend/export.js
[Export selected layers]Export multiple selected layers from Photoshop with scripting #Photoshop
app.activeDocument.suspendHistory("Export as png", "main()");
function main() {
if (app.documents.length) {
var docRef = app.activeDocument;
if (docRef.layers.length) {
var selected = getSelectedLayersIdx();
for (var i = 0; i < selected.length; i++) {
var layer = selectByIndex(selected[i]),
width = layer.bounds[2] - layer.bounds[0],
@Arahnoid
Arahnoid / exportSprites.js
Last active April 21, 2019 22:55 — forked from zaphire/exportSprites.js
[Exports as sprites]Exports photoshop layers as individual sprites, by Tuba #Photoshop
/*Maximum spriteSheet width -> FIXED*/
var maxWidth = 256;
var filename = activeDocument.name.replace(".psd","");
var file = new File(activeDocument.fullName.path+"/"+filename+".xml");
var AD = activeDocument;
var output = new File(activeDocument.fullName.path+"/"+filename+".png");
var pngOptions = new PNGSaveOptions();
@Arahnoid
Arahnoid / gist:6a16c3c813f0bc4c8dca
Last active April 21, 2019 22:56 — forked from keriber/gist:fd8246589145d428fd2f
[Photomerge multiple images ]Photomerge multiple images in Photoshop CC using JavaScrip#Photoshop
//This will be the direcotry of the images
var workFolder = Folder("Z:/Bermudez-Hernandez/Strains Project/Animals/C57_20/Prox1_NeuN/Slide2");
var folders = workFolder.getFiles();
runphotomergeFromScript = true;
//runphotomergeFromScript = true;
$.evalFile( "C:/Program Files/Adobe/Adobe Photoshop CC/Presets/Scripts/Photomerge.jsx")
//photomerge.createPanorama(
//fileList, displayDialog );
psdOpts = new PhotoshopSaveOptions();
@Arahnoid
Arahnoid / ps-rotating-sprite.js
Created November 5, 2015 20:04 — forked from phalkunz/ps-rotating-sprite.js
Photoshop script for preparing a sprite for rotating animation
/**
* Photoshop script for preparing a sprite for rotating animation.
* Input : a starting sprite and number of frames
* Output: the specified number of layers ready to be used in the PS animation tool
*/
var docRef = app.activeDocument;
var activeLayer = docRef.activeLayer;
var degToRotate = null;
var newLayer = null;
@Arahnoid
Arahnoid / export_script.js
Last active April 21, 2019 23:19 — forked from itamar/export_script.js
[Groups to PNG] Export photoshop groups to different PNG files #Photoshop
#target photoshop
function main(){
if(!documents.length) return;
var doc = activeDocument;
var oldPath = activeDocument.path;
for(var a=0;a<doc.layerSets.length;a++){
activeDocument.activeLayer = activeDocument.layers.getByName(doc.layerSets[a].name);
dupLayers();
var saveFile= File(oldPath +"/"+doc.layerSets[a].name +".png");
SavePNG(saveFile);
@Arahnoid
Arahnoid / grid_builder.js
Created November 5, 2015 19:59 — forked from wilkerlucio/grid_builder.js
Photoshop Grid Generator
var DocumentArea = function(doc) {
this.doc = doc;
};
DocumentArea.prototype.bounds = function() {
return [0, 0, this.doc.width, this.doc.height];
};
var DocumentArea = function(doc) {
this.doc = doc;
@Arahnoid
Arahnoid / LayersToSpriteSheet.js
Created November 5, 2015 19:40 — forked from ChrisAntaki/LayersToSpriteSheet.js
Photoshop: Layers To Sprite Sheet
// Notes:
// 1. Save this file in Program Files\Adobe\Photoshop\Presets\Scripts\
// 2. Run the script by going to menu File > Scripts > LayersToSpriteSheet
// Based on http://alessandroituarte.com/blag/2012/07/03/470
if (documents.length > 0) {
// Adjust this to the number of columns you want
// leave -1 if you want it to calculate an optimal column value.