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

Stopping an action when the bottom-most layer is reached

New Here ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

Hello all, 

 

I'm looking to get assistance on creating an action in Ps to automatically remove background from images, but the problem I'm running into is when I stack all those images as layers, and run the action (remove background quick action, select backward layer, and then loop back to remove background, and so on), I have no clue how to make it stop after it's selected the bottom most layer in the stack, it just switches to the topmost one and continues going.

 

In essence I'm making GIF animations from green screen footage, and needed a way to automate it somehow, because removing the BG on 50+ stacked GIF layers is a bit tedious.

 

Any assistance with this would be greatly appreciated.

TOPICS
Actions and scripting

Views

568

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

correct answers 1 Correct answer

Community Expert , Nov 14, 2019 Nov 14, 2019

In an action you can start at the top or buttom of visible layer  and process visible layers relative the the starting position. However there is no action conditional you can user to know when to stop. You can come close if yout start at the top and the is a  visible background layer but then you can not remove the background in a photoshop background layer and many documents do not have a background layer

image.png

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

I'm a bit confused as to what you're doing. As far as I know, an action can't loop, so are you using a script? Do you just want to delete the bottom layer? You can just select the bottom layer with the shortcut alt/opt-,

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 ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

In an action you can start at the top or buttom of visible layer  and process visible layers relative the the starting position. However there is no action conditional you can user to know when to stop. You can come close if yout start at the top and the is a  visible background layer but then you can not remove the background in a photoshop background layer and many documents do not have a background layer

image.png

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
New Here ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

JJMack, you are a saviour! I wasn't aware that you could set conditional actions, so what I did was stacked all my to-be-GIF layers, created a locked layer at the very bottom of the stack, just a dummy one, and added that conditional action for the loop to trigger a stop action if it detects a locked layer. Worked like a charm! 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
New Here ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

In essence I'm making GIF animations from green screen footage, and needed a way to automate it somehow, because removing the BG on 50+ stacked GIF layers is a bit tedious.

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 ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

Please post a screenshot of the action will all steps expanded.

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
New Here ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

Here's what I've got after adding the conditional action JJ Mack mentioned, see above.

Screenshot_5.png

It works well like this now.

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 ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

A script can easily detect the last layer:

var doc = activeDocument;
if(doc.activeLayer == doc.layers[doc.layers.length-1]){alert('this is the last layer')}

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 ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

/* 
Lena wrote:
In essence I'm making GIF animations from green screen footage, and needed a way to automate it somehow, because removing the BG on 50+ stacked GIF layers is a bit tedious.
*/

 

FYI, there are numerous scripts that will iterate/loop an action over all layers in a file.

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
New Here ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

I was good on how to create a loop, may not have worded it well, but I was trying to add a way to stop it. Sorry 'bout the confusion, I'm a bit new to all this.

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 ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

LATEST

Actions can have problems doing this as you found, a script doesn't, it knows when to stop without having to be explicictly told to do so.

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