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

How can i remove all the selected contents on several layers at once?

Community Beginner ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Hi all,

I'm working a hundred layers psd files, and i have to remove contents on several layers that out of my need.

So right now i'm using marquee selection tool to select my need part, then reverse it and manually remove all the unwanted content that in reversed selected on severial layers, one by one.

I wonder if there are any method that quickly remove all that selected contents on several layers at once?

Is there any script that help?

 

If you guys know or have any idea, please share with me.

 

Thank you.

 

Vuong Quoc

TOPICS
Actions and scripting , Windows

Views

430

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

Guide , Sep 02, 2021 Sep 02, 2021
quote

So right now i'm using marquee selection tool to select my need part, then reverse it and manually remove all the unwanted content that in reversed selected on severial layers, one by one.


By @ViXiMiXiV

 

a) create a selection in the document b) select the required layers on the layers palette c) run the script

@JJMack tried to explain, that layers may be different and the approach to removing content in them can be different, however, you said that we are talking about "normal layers" (I do n

...

Votes

Translate

Translate
Adobe
LEGEND ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

One could probably cobble together a simple script that iterates through all layers and executes the delete command...

 

Mylenium

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Thank for your kind reply...
It'd be good if i can find that script!

Vuong Quoc

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Photoshop has diffent kind of layers. Some layed kinds cans not be altered to remove part of its content by deleting pixels.  However, you could hide the area in all the selected layers with Masking.  That can be be scripted and have a shortcut..

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 Expert ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

»Some layed kinds cans not be altered to remove part of its content by deleting pixels.«

Good point. 

For Groups, Adjustment and Fill Layers one could check for Layer Masks and, if existing, fill with black, but what to do with Type Layers for example? 

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Thank you for your reply,

My files almost normal layer with brushes, i can manually select those layers one by one and del... 
The point is to reduce file size and remain only needed parts so Masking is not an option to me...

 

Vuong Quoc

 

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Deleting details in a raster layers will not reduce the size of saved layered file size to a any great extent. Deleting  and merging layers may reduce file size quite a bit. . Some layers have high overhead like embedded smart object layers contain as copy of an Image file the can be  a huge  layered file. With fewer Layers Photoshop will also perform better. You cans target several layers and drag them to the trash.

A 4TB external disk is not expensive these days.  All you may gain with smaller files may be a little I/O time opening and saving files. Larger uncompressed file may save you some  processing time spent  compressing and decomplessing data..

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Thank you JJMack,
Reducing file size and can not combine layer is the must. I'm reducing files size and remain layers for next work in AE.

After removing unwanted contents, my files size is reduced to 1/5-1/6 before so that a lot of help processing in AE.

 

Vuong Quoc

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
Guide ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

var s2t = stringIDToTypeID;

(r = new ActionReference).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var lrs = executeActionGet(r).getList(p),
    sel = new ActionReference();

for (var i = 0; i < lrs.count; i++) {
    sel.putIdentifier(s2t('layer'), p = lrs.getReference(i).getIdentifier(s2t('layerID')));
    (r = new ActionReference).putIdentifier(s2t('layer'), p);
    (d = new ActionDescriptor()).putReference(s2t("target"), r);
    executeAction(s2t('select'), d, DialogModes.NO);
    executeAction(s2t('delete'), undefined, DialogModes.NO);
}

(d = new ActionDescriptor()).putReference(s2t("target"), sel);
executeAction(s2t('select'), d, DialogModes.NO);

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Hi jazz-y,

Thank you for you script but nothing happen after i run this script.

 

Can you give a little bit more details on how (to make) it works? 

 

Vuong Quoc

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
LEGEND ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

LATEST

Did you make selection on the canvas?

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Hi jazz-y,

I found out that we need to select all the folder/layers before runing this script to start working but... after that, this error appears (see attachment)

 

Please have a look,

Thank you.

 

Vuong Quoc

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
Guide ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

quote

So right now i'm using marquee selection tool to select my need part, then reverse it and manually remove all the unwanted content that in reversed selected on severial layers, one by one.


By @ViXiMiXiV

 

a) create a selection in the document b) select the required layers on the layers palette c) run the script

@JJMack tried to explain, that layers may be different and the approach to removing content in them can be different, however, you said that we are talking about "normal layers" (I do not know what this means, but I assumed that these are pixel layers).
The script removes the content of only pixel layers. I added a check for the type of layer to the code so that you can safely select groups and layers of other types - it will simply ignore them.

 

var s2t = stringIDToTypeID;

(r = new ActionReference).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var lrs = executeActionGet(r).getList(p),
    sel = new ActionReference();

for (var i = 0; i < lrs.count; i++) {
    sel.putIdentifier(s2t('layer'), s = lrs.getReference(i).getIdentifier(s2t('layerID')));

    (r = new ActionReference).putProperty(s2t('property'), p = s2t('layerKind'));
    r.putIdentifier(s2t('layer'), s);
    if (executeActionGet(r).getInteger(p) == 1) {
        (r = new ActionReference).putIdentifier(s2t('layer'), s);
        (d = new ActionDescriptor()).putReference(s2t("target"), r);
        executeAction(s2t('select'), d, DialogModes.NO);
        executeAction(s2t('delete'), undefined, DialogModes.NO);
    }
}

(d = new ActionDescriptor()).putReference(s2t("target"), sel);
executeAction(s2t('select'), d, DialogModes.NO);

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 ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Hi @jazz-y 

Thank you for your kind explains and modified script!
It's working great!!! Help me out of alot of work!

 

---

Vuong Quoc

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