[Webinar] Learn how to a build a cloud-first strategyRegister Now


Detecting guides in photoshop script

Posted on 2009-04-16
Medium Priority
Last Modified: 2012-05-06
I need to automate the processing of about 2500 product images and I think scripting Photoshop is the best way to do it.

For each image I need to:
1) Straighten it
2) Crop it leaving a set amount of space around the bounding box of the product
3) Fade from the edge of the product's bounding box to the edge of the image, going from the current background colour (almost white) to white

I am hoping to do this as follows:

1) A human opens each image, straightens it and defines the bounding box of the product using guides (I think that's what they are called - they blue lines you drag in off the side rules using the move tool) and saves the image.

2) A script opens up each image and, using the canvas size and the size and location of the bounding box, crops and adds the fades to the image.

This should be *much*faster than getting someone to do it all by hand, and also gives me the option to re-run the batch processing later if I want to change one of the parameters.

Is this a workable solution?  Can I detect the guides in a Photoshop script?  If not, can you think of an alternative method of recording the specification of the bounding box of each product so that a script can access it?

I considered creating another layer and drawing a rectangle over the bounding box of the product for example, and then getting the script to detect the edges of the rectangle...

I dont have any experience scripting Photoshop, I just want to make sure that what I am trying to do is possible before starting out!

We sell Single Malt Scotch Whisky (all the images are whisky) so if anyone feels like writing the script for me we might be able to come to an arrangement involving a few bottles of the good stuff ;-)



Question by:jtp101
  • 2
  • 2
LVL 12

Accepted Solution

alien109 earned 1200 total points
ID: 24158344
use a channels instead? have the user make a rectangular selection and then save the selection. then after opening the image in the script, load the selection, get it's bounds and go from there.

Author Comment

ID: 24158648
Brilliant  that sounds like it would work!

Do you know anyone who would be able / interested in writing the script to handle the images once the selection has been saved?  I can pay in Whisky or, if needs be, cold hard cash.

Out of interest, do you know that detecting the guides wouldnt work or did the alpha channel method just seem like a nicer way to do it?
LVL 12

Expert Comment

ID: 24159382
I don't believe you have access to the guides via scripting. At least for JavaScript that is.

I don't have time at the moment to write the script, even though it isn't that difficult. So if someone else wants to jump in, please do. If no one else can, I'll try to see if I can get to it later (tonight, maybe?)


Author Comment

ID: 24191824
If you could put a script together or recomend someone who could I would be very grateful.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The Summer 2017 Scholarship Winners have been announced!
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month20 days, 12 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question