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

Rasterize/Flatten layer transparency quickly

Contributor ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

For most effects you can just right-click the layer and "Rasterize".

But you can't do this if the only effect is layer transparency.

Let's say you have hundreds of layers, each with a different transparency, and you want to rasterize each one individually this so the pixels are just transparent, and it's not a layer setting.  Is there a faster or better way than making one hundred more new layers, placing each under the old layer, flattening, then re-pasting the layer name?  Surely there must be a better way...

Views

3.8K

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

Contributor , Aug 26, 2020 Aug 26, 2020

UPDATE: in case this helps anyone else, the quickest hack I've found so far is to apply some bogus layer effect (ie. color overlay at 0%), then hold down the Alt key and drag/apply it to all the transparent layers.  Then it's possible to right-click -> rasterize.  This is quicker than creating new layers and flattening.

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

I'd add a new blank layer above the layer then merge down.

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
Contributor ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

Yeah, I guess that saves having to re-paste the layer name.  But making and flattening hundreds of layers just to rasterize transparency is just.. there just has to be a better way..

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 ,
Aug 27, 2020 Aug 27, 2020

Copy link to clipboard

Copied

There is a better way, record the steps into an action or script. Automating via action or script is faster. It takes approx 0.06 seconds (according to my JavaScript action timer) for an action to create a new layer above the current layer and merge down). This is approx. the same time as the rasterize command. Either way, automation is the answer to productivity.

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
Contributor ,
Aug 27, 2020 Aug 27, 2020

Copy link to clipboard

Copied

Yeah, you're right.. it could be automated.  I already have a "flatten folder, move up" action.  This wouldn't be too different.  But even that action takes about 1-2 seconds per layer for me.  Although flattening a whole folder would take longer than just two layers.  My other hack that I posted below may or may not be faster just because dragging a (bogus) layer effect is quite quick, and then rasterizing ~20 layers at a time is quick too.  But I'll try out both, thank you for the idea!  This might turn out to be faster. Cheers!

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 ,
Aug 27, 2020 Aug 27, 2020

Copy link to clipboard

Copied

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 ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

Try File>Scripts>Flatten All Layer Effects

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
Contributor ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

So.. I tried this... and I had to step away from the computer because it took a while.. 15 minutes or more.  Finally I get access again and.. believe it or not, this did NOT rasterize the transparency.  All my "85%" transparency layers are still 85% transparency O_O

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
Contributor ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

So I guess what I'm saying is, I'm requesting that when you right-click a layer and select "Rasterize", it also includes layers with only transparency applied...

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 ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

What exactly are you wanting to happen when you "rasterize" a transparent layer?

 

You can post screenshots if it will help explain.

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
Contributor ,
Aug 18, 2020 Aug 18, 2020

Copy link to clipboard

Copied

For the "Opacity" layer setting to go from X% (eg. 85%) to 100%, and for the transparency to be permanently applied to the pixels on that layer.  For example, if the transparency was 50%, and you'd rasterize, the opacity setting would reset back to 100%, and all the pixels on the layer would be permanently transparent.

 

This already happens if there's a transparency set AND a blend mode set at the same time, and you rasterize.  I have no idea why they wouldn't have the same thing happen when it's just the transparency that's set.

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
Contributor ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

UPDATE: in case this helps anyone else, the quickest hack I've found so far is to apply some bogus layer effect (ie. color overlay at 0%), then hold down the Alt key and drag/apply it to all the transparent layers.  Then it's possible to right-click -> rasterize.  This is quicker than creating new layers and flattening.

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
Contributor ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Well it's 2022 and I ended up back on my thread since I still need this and it still doesn't exist 

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 ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Select the Layer, press command g (Layer > Group Layers) then press command e (Layer > Merge Down).  This is a little bit faster than the approach of creating a new, empty layer, but the resulting Layer Names (Group 1, Group 2, Group 3) will need a little housekeeping to restore descriptive Layer Names.

 

I'm not sure if this approach as been mentioned...
1. Use File > Export > Layers to Files...
Screen Shot 2022-10-04 at 2.56.56 PM.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Browse to a new folder to temporarily hold the individual files.  File Type of PSD or PNG-24 should work well.  Be sure to enable Transparency and disable Trim Layers in the Export Layers to Files dialog box.

 

2. File > Scripts > Load Files Into Stack.  Choose the folder created in step 1.  The padded numbering (0000, 0001, 0002, etc.) of the Export Layers to Files process should allow Photoshop to stack the Layers in the correct order from front to back.

 

Once the resulting layered Photoshop document is saved, the folder containing the layers from step 1 can be deleted or archived.

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 ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

LATEST

The following script works on multiple selected layers. For simplicity and speed, it merges, rather than rasterizes - however, the end result should be the same.

 

/* 
Rasterize selected layers opacity.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/rasterize-flatten-layer-transparency-quickly/m-p/11393469
Stephen Marsh - 5th October 2022, v1.0 
*/

#target photoshop

function main() {

    ///// Process selected layers - from jazz-y /////
    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);
        
        /////
        
        var layerName = activeDocument.activeLayer.name;
        layerToGroup();
        activeDocument.activeLayer.merge();
        activeDocument.activeLayer.name = layerName;

        function layerToGroup() {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var reference = new ActionReference();
            var reference2 = new ActionReference();
            reference.putClass(s2t("layerSection"));
            descriptor.putReference(s2t("null"), reference);
            reference2.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            descriptor.putReference(s2t("from"), reference2);
            executeAction(s2t("make"), descriptor, DialogModes.NO);
        }
    }
}
app.activeDocument.suspendHistory("Rasterize selected layers opacity", "main()");

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

 

Edit: This v2 uses layer style and rasterize:

 

/* 
Rasterize selected layers opacity.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/rasterize-flatten-layer-transparency-quickly/m-p/11393469
Stephen Marsh - 5th October 2022, v2.0 
*/

#target photoshop

function main() {

    ///// Process selected layers - from jazz-y /////
    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);

        /////

        if (haslayerEffects() === false) {
            addStyle();
            rasterizeLayer();
        } else {
            rasterizeLayer();
        }

        ///// Functions /////

        function haslayerEffects() {
            try {
                var d = new ActionDescriptor();
                var r = new ActionReference();
                r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
                var options = executeActionGet(r);
                return options.hasKey(stringIDToTypeID("layerEffects"))
            } catch (e) {
                alert(e)
            }
        }

        function addStyle() {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var descriptor2 = new ActionDescriptor();
            var descriptor3 = new ActionDescriptor();
            var descriptor4 = new ActionDescriptor();
            var reference = new ActionReference();
            reference.putProperty(s2t("property"), s2t("layerEffects"));
            reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            descriptor.putReference(s2t("null"), reference);
            descriptor2.putUnitDouble(s2t("scale"), s2t("percentUnit"), 200);
            descriptor3.putBoolean(s2t("enabled"), true);
            descriptor3.putBoolean(s2t("present"), true);
            descriptor3.putBoolean(s2t("showInDialog"), true);
            descriptor3.putEnumerated(s2t("mode"), s2t("blendMode"), s2t("overlay"));
            descriptor4.putDouble(s2t("red"), 128); // value
            descriptor4.putDouble(s2t("grain"), 128); // value
            descriptor4.putDouble(s2t("blue"), 128); // value
            descriptor3.putObject(s2t("color"), s2t("RGBColor"), descriptor4);
            descriptor3.putUnitDouble(s2t("opacity"), s2t("percentUnit"), 0); // opacity
            descriptor2.putObject(s2t("solidFill"), s2t("solidFill"), descriptor3);
            descriptor.putObject(s2t("to"), s2t("layerEffects"), descriptor2);
            executeAction(s2t("set"), descriptor, DialogModes.NO);
        }

        function rasterizeLayer() {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };

            var descriptor = new ActionDescriptor();
            var reference = new ActionReference();

            reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            descriptor.putReference(s2t("null"), reference);
            descriptor.putEnumerated(s2t("what"), s2t("rasterizeItem"), s2t("layerStyle"));
            executeAction(s2t("rasterizeLayer"), descriptor, DialogModes.NO);
        }
    }
}
app.activeDocument.suspendHistory("Rasterize selected layers opacity", "main()");

 

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