
A year and a half ago I was in the process of developing the automatic background removal system you can learn about HERE. One of the scripts was supposed to work like this: a color sample gets picked in a particular point, then it gets compared with some standard color, and then it gets picked again in the next point. There are 8 points where the color samples get picked – in the corners and in the middle of each side. Instead of manually instructing the color picker where to click each time, I used a cycle that, well, cycled through points moving the picker from each to the next until it clicked all 8.
As I told you already, I am not a programmer, and every programming task is extremely challenging for me. I've managed to do what I needed after quite a bit of struggling, but another idea was born in the process, and this is how I've made the script I'm going to describe in this blog post.
If the color picker has to move from point to point around the image, why not have some fun? Why not make the script create square selections and fill them with the color that gets picked, square by square? Wouldn't I get pixel art?
Yeah, I know, I know. There's the Mosaic filter in the Pixelate submenu of the Filter menu in Photoshop that does exactly the same: gets your image pixelated with the given square size. In just a second. But is this fun? No.
So I've made a script that takes ages to work, doesn't anything except what I described, and sometimes makes creepy images due to some lag I don't understand. Now, this sounds like fun!
It's coding time!
#target photoshop
var doc = app.activeDocument;
var width = doc.width;
var height = doc.height;
var x = 0;
var y = 0;
var size = 30; //SIZE OF THE "PIXEL" HERE
function main() {
while (x <= width) { var pixelLoc = [x , y]; var myColorSampler = doc.colorSamplers.add(pixelLoc); var myColor = myColorSampler.color; doc.selection.select( [[x, y], [x, y+size],[x+size, y+size], [x+size,y]] , SelectionType.REPLACE, 0, true); doc.selection.fill(myColor, ColorBlendMode.NORMAL, 100, false); doc.colorSamplers.removeAll(); x=x+size if (x >= width)
{
x = 0;
y = y +size;
}
if (y >= height)
{
doc.selection.deselect();
return;
}
}
}
app.activeDocument.suspendHistory ("Mindful Retouch Creepy Pixel", "main()");
To make it work, all you have to do is save the code above to a *.jsx file and then run it via Photoshop (File/Scripts/Browse…). Or just load it in the ExtendScriptToolKit and run directly – which also gives you the possibility to change the script contents on the fly. The most important string is marked with green: the "size" variable determines the size of the square in pixels. The bigger the square, the faster it works, and vice versa.
As the script tends to work for a very long time, make sure you don't overload it by specifying a small square size and running it on a large image. It takes 7 seconds to process a 300 by 300 image with a 30 "pixel" square, imagine how much time it would take on huge images and small "pixel" squares. 1000 by 1500 image and 20 "pixel" size takes about 5 minutes to process. Beware! And also be careful when applying the script to people. Some portraits I've tried it on turned out extremely creepy. No kidding!

Have fun and don't forget to retouch mindfully!
doesn't work, photoshop throws an error at me saying there is missing ; on line 9
ordering cialis online
ordering cialis online