Tuesday, May 11, 2004 11:34 AM
by
scottholden
More photoshop automation (jscript this time!)
So I am going wild on automating my processes for web site generation with regards to photos. I really want to make it easy for me to post photos now and for future.
I have added a watermark to many of my photos! http://www.airjockeys.com/galleries/action.
The problem is that the watermark needs to be a range of colors for different pictures. So, I used Jscript to automate this process in photoshop. The steps:
1. I created my watermark with two different images: a black and a white version. Each image is a different layer in a PSD.
2. Assume that the current active image is the one to add the watermark to.
3. Open the watermark and compute the size. I do this as a percentage of the longest side of the image. This way, the watermark is exactly the same size for each photo on my site. Convert the watermark to the correct size (it is really large to begin with and I scale it down).
4. Determine a location that the watermark will go on the photo. Crop a copy of the photo and get a histogram of the cropping. I then can determine the normalized median (half the pixels in the histogram array);between 0 and 1. This gives me how light/dark the area is. 0 is darkest, 1 is lightest.
5. I then duplicate the correct watermark layer over to the photo and adjust opacity based on the normalized median. For example, between 0 and .33 I use a 30% opacity image and .44 to .50 I use a 50% opacity white image.
6. Move the watermark to the predefined location.
Of course, the watermark is many times not quite in the correct location and I just have to move it slightly. But overall this works pretty well and has definitely reduced my process while getting consistent results across photos.