Skip

Automate color selection in photoshop?
July 17, 2011 11:12 PM   Subscribe

Is there a way to automate color selection in photoshop?

Howdy,

I have a big batch of graphic images I need to process for a project I'm working on. These images are all identical in size and they all have a single solid color backdrop (with a design in the center). One of the steps in my automation requires me to enlarge the canvas of the image, and I need the new area to match the existing background color of the image. The rub is that I've got 100's of files to do and they all have a different random solid colored background, and so far I can't seem to find out how to automate selecting a color based an the current image.

The canvas size options let you select a specific color, or use the foreground /background color. I can also use the eyedropper tool while recording the action but that only records the specific color selection I made during the recording.

All of the images have areas I know I can safely sample from, so if there was any way to have an action record the actual act of selecting the eyedropper tool and choosing a specific point. Also of note is that the background color of each image is by far the most common color in each image, so if there is any way to find the dominant color in an image using histograms or whatnot then that would be a possible strategy.

Any ideas for me? Thanks!
posted by Jezztek to Computers & Internet (10 answers total) 1 user marked this as a favorite
 
I'd be surprised if there isn't a way... perhaps an option in the actions settings or in the eyedropper settings.

The only thing that comes to mind would be to set up your action, insert a "stop" so that you can select a FG colour, and then resume the action. If there's a keyboard shortcut for "resume action", it would reduce your participation to simply sampling the colour and hitting the "go" key.

Have you looked into 3rd-party macro programs? I haven't used it in a decade, but I seem to remember that utilities like Quickeys would let you record mouse clicks & whatnot. If you're using a Mac, maybe Automator includes that sort of functionality.
posted by TangoCharlie at 11:29 PM on July 17, 2011


According to the manual, the eyedropper will record the position sampled so that it can be played back, but you need to set the ruler units to percentage if you want that recorded position to be the same for images of different sizes.
posted by Rhomboid at 2:37 AM on July 18, 2011


Hmmmmm, I'm running CS4 and that's not how it works (at least not out of the box), that must have been a change for CS5. Perhaps it's time to upgrade.
posted by Jezztek at 2:40 AM on July 18, 2011


Hmm, the CS4 page says basically the same thing.
posted by Rhomboid at 2:47 AM on July 18, 2011


Hmmmmm, it says "Results depend on file and program setting variables" maybe the answer is in the program setting variables?

Because as it is now if I use the eyedropper during record it only records the color value I selected during the record and uses that for every image, instead of recording the act of eyedropping a specific point.
posted by Jezztek at 2:56 AM on July 18, 2011


Could you record an action that selects the first pixel in the top left-hand corner and then uses that as a pattern fill on a background layer?
posted by bcwinters at 3:58 AM on July 18, 2011


Gin up an action that selects and copies the top left pixel, and then creates a new layer beneath everything else into which you paste that pixel and transform it to cover the whole layer. Flatten image and you are good.

Might be able to do it as a pattern, too, but I'm on my phone and can't test.
posted by dirtdirt at 4:36 AM on July 18, 2011 [1 favorite]


Not all tasks in actions can be recorded directly; however, you can insert most nonrecordable tasks using commands in the Actions panel menu.

Is selecting a color at a specific location one of the actions that needs to be manually inserted, perhaps?
posted by jsturgill at 8:21 AM on July 18, 2011


If no Photoshop-specific solution comes up, I've been getting into AutoIt lately, which lets you write scripts that can send mouse clicks and button presses to any program running.
posted by RobotHero at 10:32 AM on July 18, 2011


Thanks guys! I tried the pattern method last night but I couldn't figure out how to get the fill tool to select the most recently created pattern to use as the fill. But the copy a pixel then stretch it to an entire layer works perfect!
posted by Jezztek at 11:36 AM on July 18, 2011


« Older African-fruit-filter: Msau: wh...   |  Santorini Honeymoon-Has anyone... Newer »
This thread is closed to new comments.


Post