2.08.2006

Script Your Images in Photoshop CS

Lately I have started to play around with scripting in Photoshop for my computer vision course. Here is something I came up with while working on a take home midterm. We had to describe an image described by an equation. Since our professor said we could write programs I decided to do it in photoshop. There are a total of 3 scripts, each of which I will describe next.

The first script is Document.js. This is simply a library function I created to make creating new documents a little easier. Rather than needing to specify all the arguments for a new image I can give a height and width and I will get a new photoshop document.

The second script is called CreateImage.js. This is the script that does all the work in Photoshop. It creates the new document and then iterates over x and y. At each pixel (x,y) a region of the image is selected and filled in with a color. The color is of type RGBColor and is retured from a function called ColorEquation. This function is passed (in order) x, y, width and height. It is your job to define ColorEquation. The function should create and return a variable of type RGBColor.

The third script is Image.js. This file defines two variables and a function (the least information needed to make an image). The variables are the width and the height. The function is called ColorEquation. This function will be given the current pixel (x,y), width of the image and height of the image. You can use these 4 values to construct a color for the pixel (x,y). The color will be stored and returned in a variable of type RGBColor.

Of course, since all of the source code is here for download, so you can it however you want. If you do make something cool please post a reply with some code. It will be cool to see.

0 Comments:

Post a Comment

<< Home