• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Creating a batch process action to subtract one background image from many other images

Community Beginner ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Hello! Novice Ps user here, I have a tedious process that I’ve been doing manually for a couple of years; I’m trying to figure out how to automate it, but having trouble finding what I need in forums. I’m a biology graduate student working with fluorescent microscopy. For each sample, I take an image under regular light, 2-3 different exposures with the red filter (looking for Red Fluorescent Protein), and 2-3 exposures with a green filter (for green fluorescent protein). Every few months I take a new set of blank images at each exposure time to account for ambient light and the dead pixels on our very old camera.

My manual workflow is

  1. Open the set of blank images, open the set of experimental images.
  2. Select “Blank 1s”, select all, copy, then paste onto “Experiment RFP 1s”
  3. Rename the layers “Pixels 1s” and “RFP 1s” to keep track of what I did (I need this for data accountability purposes)
  4. Select “Pixels 1s” layer > blending options > difference
  5. Then I Save As a PSD with a slightly new name “Experiment RFP 1s pixels removed” and as a JPEG with that name as well. This way I’m not altering original files, and if I need to, I can go back and see the chain of alterations I made to each image.
  6. After I do this for each image, I select which exposures to use (depending on my control I will have to choose a longer or shorter exposure time to avoid using an overexposed image). Then I need to create a layered image.
  7. *If I could just automate the above that would make my life so much easier, the next part would be icing on the cake*
  8. I open the three renamed files of a particular experimental sample, Light, RFP (chosen exposure time) and GFP (chosen exposure time) each one having background subtracted.
  9. Select all of the RFP, copy, paste onto the light image, then do the same with the GFP image.
  10. Rename the three layers “Light” “RFP 1s” “GFP 2s”
  11. Create a new layer
  12. Use the polygonal lasso tool in the new layer to draw an outline of the structure, then select> modify> smooth  (40), then select> modify> border (5) and fill with white at 50% opacity. Since it’s not a closed structure I go back with the erase tool to erase the extra part of the line I’ve created. (I understand if I need to do most of this part manually. I’ve tried a couple of automatic, snap-to options, but it doesn’t correctly identify the border of the structure.)
  13. Save the layered image as a PSD, then save each layer independently as a JPEG: “Light outlined” (Light layer plus outline layer visible), “RFP outlined” (RFP + outline layer), and “GFP outlined” (GFP + outline layer). I can then arrange these into a picture, but how to improve on that process is a question for another day.

Any help would be greatly appreciated! All images are the same size, taken at the same magnification, and are JPEGs because of some equipment limitations we have.

TOPICS
Actions and scripting , Windows

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

If you can not automate: 

6. After I do this for each image, I select which exposures to use (depending on my control I will have to choose a longer or shorter exposure time to avoid using an overexposed image). Then I need to create a layered image.

 

You can not create a batch process

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Thank you for responding. Could I automate the steps leading up to that, steps 1-5? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

My apologies, I just realized the latter numbers in the post got messed up.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Do you have any experience building actions, if not scripting?

 

You have a very unique set of image processing requirements, so you will probably have to build the automation of the workflow yourself, with the advice and possible help of the forum, internet searches etc.

 

As one action may not do it all in a single go, I'd suggest that you create multiple actions to handle each set of steps as much as possible. There will be points where an action may need a "helper script" to achieve an outcome that is not possible with an action. 

 

Build your automation one step at a time, incremental automation will improve efficiency and reduce the tedious and or error prone nature of the manual steps.

 

Creating actions is the easiest way to automate and to help identify roadblocks which may or may not be overcome with scripts or manual steps.

 

Screenshots and sample files would also help anybody willing to invest their time in helping on your project. Each step may need detailed explanations of input, processing and output steps as there are so many unkowns that only you will know or find out as you build your actions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Thank you for writing. 

The only experience I have with building actions is what I've taught myself in the past few days, and as for scripting - I've had a *very* brief introduction to Python (for Pymol) and R. I'm fine building the workflow myself, I just don't have the experience to know what steps in my manual workflow really complicate automation. I'm getting the sense that renaming layers/files is a hindrance since it can't be recorded in an action, does that sound right? If I could figure out something else with the renaming, how would I go about building a simple action to subtract one image from another, steps 1-5 without the renaming? I tried to create an action for this, but what I've run into is when I play the action, it selects the current image, copies, pastes, and subtracts (difference) that image from itself instead of from the other image (assuming all I have open is one blank and one experimental). Could you point out which steps could be done with actions and which with scripts? Also, could all of this be done within Ps, or do I need to get other CC software like Bridge? I can't afford much, but I'm willing to figure out a way to budget other software if I need it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

What version of Photoshop is that?

 

Then move onto step 1. At each step you'll need to identify what can be automated, semi-automated or manually performed.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

Version 6.0. Yup. Sucks being in academia. The computer hooked up to our camera still runs on XP! Thanks for the help, I will work on it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

Sadly, I don't believe that you will have access to scripting in such an old version. If memory serves correct, scripting support was added in v7 via a plug-in, then in later releases it was a native feature.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 11, 2021 Jun 11, 2021

Copy link to clipboard

Copied

LATEST

Understood. I'll do what I can with the actions. Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Removing backgrounds varies greatly depending on the specific image you're working with. 

What works for one type of image could be an utter failure in another.  

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

"

  1. Open the set of blank images, open the set of experimental images."

 

To open set of images you must have all files with the same name all the time or simply record step(s) to open Open dialogue(s) where you can select one at the time or multiple images to open. When recording this step as dialogue to select images use Insert Menu Item command from the actions panel or turn on modal control for that step.

 

"

  1. Then I Save As a PSD with a slightly new name “Experiment RFP 1s pixels removed” and as a JPEG with that name as well. This way I’m not altering original files, and if I need to, I can go back and see the chain of alterations I made to each image."

 

When recording step to save image you can either record step to open Save As dialogue as explained above for Open command or to record exact path where to save file with exact file name. Second mentioned option can cause problem, be aware that next run of action will overwrite previous file without warning.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

Thank you, Bojan. Yes, I will see what I can do with dialog boxes; I've already run into the overwrite issue. Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines