Created
September 21, 2010 01:42
-
-
Save juliend2/589030 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Expanding color pixels on the current (and only loaded image) | |
*/ | |
var doc = app.documents[0]; | |
doc.colorSamplers.removeAll(); // otherwise it will create an error if there is already a colorSampler on this point | |
var offset = 4; | |
for (var w=0; w < doc.width; w+=offset) { | |
for (var h=0; h < doc.height; h+=offset) { | |
try { | |
doc.colorSamplers.removeAll(); | |
var cSampler = doc.colorSamplers.add([w+1,h+1]); | |
var color = cSampler.color; | |
doc.selection.select([ | |
[w,h], | |
[w+offset,h], | |
[w+offset, h+offset], | |
[w,h+offset] | |
]); | |
doc.selection.fill(color); | |
} catch (e){} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment