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

P: Export As now crops to contents instead of using the mask

Community Beginner ,
Aug 24, 2021 Aug 24, 2021

Copy link to clipboard

Copied

I noticed in new version of Photoshop the Export As... function no longer uses the mask but instead crops to contents. 

For example if you make a group with a 512x512 mask, place an image inside it with some space around it, Export As does not export the 512x512 masked are but instead crops to the content image. 
I don't see how this is useful change as if you've masked the group and wanted to export only its contents you would just export the layer with contents, not the masked group.

There is a workaround though, you can switch back to Legacy Eport settings in preferences, but then again everyone who uses the psd has to do the same to get it working properly. 

Does anyone know another workaround for this that would not require switching to Legacy settings?

I can see this change causing issues to a lot of users and frankly can't see the benefits to this change.


 

Bug Unresolved
TOPICS
macOS , Windows

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

Community Expert , Mar 23, 2022 Mar 23, 2022

HEllo, I think this function exists only in the legacy export as function that you activate with the menu Edit Photoshop/Preferences/Export

Votes

Translate

Translate
60 Comments
New Here ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Hello @PECourtejoie , Thank you for your answer,

I'm not sure to understand what I should do/change in the export preferences. I have the exact same settings as on my previous computer (which worked).

Screenshot_20220323-2.png

Votes

Translate

Translate

Report

Report
Community Beginner ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Hey, @julieb28824091 

 

I can only offer a "work around". 

Go to programs, right click Photoshop and in the "information" menu – select open with Rosetta.  

 

Bildschirmfoto 2022-03-23 um 17.54.31.png


That way it behaves like it used to for me. But it is also slower this way and there's a bug in this mode, where PS might crash if you try to move a shape's point and transform the shape into a regular path. (Can happen, but doesn't always.)

Votes

Translate

Translate

Report

Report
Community Expert ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

This version of the previous script works with all applicable layers:

 

/*
Transparency Bounding Pixels to All Layers.jsx
Stephen Marsh
Version 1, 5th March 2022
Adds a 1% white pixel to the upper left and lower right corners of the open document
Note: Assumes that the active layer is a raster layer that can be filled!
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/export-as-now-crops-to-contents-instead-of-using-the-mask/td-p/12336888
*/

#target photoshop

if (documents.length) {
    var origRuler = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var docWidth = app.activeDocument.width.value;
    var docHeight = app.activeDocument.height.value;

    function main() {
        selectFrontOrBackLayer("front", false);

        var lyrCount = app.activeDocument.layers.length;
        for (var i = 0; i < lyrCount; i++) {
            app.activeDocument.activeLayer = app.activeDocument.artLayers[i];
            // If layer isn't background
            if (!app.activeDocument.activeLayer.isBackgroundLayer) {
                try {
                    addTransPixels();
                } catch (e) {}
            }
        }

        app.runMenuItem(stringIDToTypeID("selectAllLayers"));
        // Export As... don't use the file menu if you wish to save individually selected layers!
        alert("Now use Export As... from the Layers panel to save the selected layers to PNG");
    }

    app.preferences.rulerUnits = origRuler;
    app.activeDocument.suspendHistory("Run script", "main()");

    /*********** Functions ***********/

    function addTransPixels() {
        setSelection(0, 0, 1, 1);
        whiteFill(1.000000);
        app.activeDocument.selection.deselect();
        setSelection(docHeight - 1, docWidth - 1, docHeight, docWidth);
        whiteFill(1.000000);
        app.activeDocument.selection.deselect();
    }

    function setSelection(top, left, bottom, right) {
        var s2t = function (s) {
            return app.stringIDToTypeID(s);
        };
        var descriptor = new ActionDescriptor();
        var descriptor2 = new ActionDescriptor();
        var reference = new ActionReference();
        reference.putProperty(s2t("channel"), s2t("selection"));
        descriptor.putReference(s2t("null"), reference);
        descriptor2.putUnitDouble(s2t("top"), s2t("pixelsUnit"), top);
        descriptor2.putUnitDouble(s2t("left"), s2t("pixelsUnit"), left);
        descriptor2.putUnitDouble(s2t("bottom"), s2t("pixelsUnit"), bottom);
        descriptor2.putUnitDouble(s2t("right"), s2t("pixelsUnit"), right);
        descriptor.putObject(s2t("to"), s2t("rectangle"), descriptor2);
        executeAction(s2t("set"), descriptor, DialogModes.NO);
    }

    function whiteFill(fillOpacity) {
        var idfill = stringIDToTypeID("fill");
        var desc279 = new ActionDescriptor();
        var idusing = stringIDToTypeID("using");
        var idfillContents = stringIDToTypeID("fillContents");
        var idwhite = stringIDToTypeID("white");
        desc279.putEnumerated(idusing, idfillContents, idwhite);
        var idopacity = stringIDToTypeID("opacity");
        var idpercentUnit = stringIDToTypeID("percentUnit");
        desc279.putUnitDouble(idopacity, idpercentUnit, fillOpacity);
        var idmode = stringIDToTypeID("mode");
        var idblendMode = stringIDToTypeID("blendMode");
        var idnormal = stringIDToTypeID("normal");
        desc279.putEnumerated(idmode, idblendMode, idnormal);
        executeAction(idfill, desc279, DialogModes.NO);
    }

    function selectFrontOrBackLayer(frontORback, makeVisible) {
        var s2t = function (s) {
            return app.stringIDToTypeID(s);
        };
        var descriptor = new ActionDescriptor();
        var list = new ActionList();
        var reference = new ActionReference();
        // "front" or "back"
        reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t(frontORback));
        descriptor.putReference(s2t("null"), reference);
        // true or false
        descriptor.putBoolean(s2t("makeVisible"), makeVisible);
        list.putInteger(1);
        descriptor.putList(s2t("layerID"), list);
        executeAction(s2t("select"), descriptor, DialogModes.NO);
    }

} else {
    alert('There are no documents open!');
}

Votes

Translate

Translate

Report

Report
Community Expert ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

This version works with selected layers:

 

/*
Transparency Bounding Pixels to Selected Layers.jsx
Stephen Marsh
Version 1, 5th March 2022
Adds a 1% white pixel to the upper left and lower right corners of the open document
Note: Assumes that the active layer is a raster layer that can be filled!
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/export-as-now-crops-to-contents-instead-of-using-the-mask/td-p/12336888
*/

//#target photoshop

if (documents.length) {
    var origRuler = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var docWidth = app.activeDocument.width.value;
    var docHeight = app.activeDocument.height.value;

    function main() {
        processSelectedLayers();
    }

} else {
    alert('There are no documents open!');
}

app.preferences.rulerUnits = origRuler;
app.activeDocument.suspendHistory("Run script", "main()");
app.runMenuItem(stringIDToTypeID("selectAllLayers"));
// Export As... don't use the file menu if you wish to save individually selected layers!
alert("Now use Export As... from the Layers panel to save the selected layers to PNG");


/*********** Functions ***********/

function processSelectedLayers() {
    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 (!app.activeDocument.activeLayer.isBackgroundLayer) {
            try {
                addTransPixels();
            } catch (e) {}
        }

        function addTransPixels() {
            setSelection(0, 0, 1, 1);
            whiteFill(1.000000);
            app.activeDocument.selection.deselect();
            setSelection(docHeight - 1, docWidth - 1, docHeight, docWidth);
            whiteFill(1.000000);
            app.activeDocument.selection.deselect();
        }

        function setSelection(top, left, bottom, right) {
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var descriptor2 = new ActionDescriptor();
            var reference = new ActionReference();
            reference.putProperty(s2t("channel"), s2t("selection"));
            descriptor.putReference(s2t("null"), reference);
            descriptor2.putUnitDouble(s2t("top"), s2t("pixelsUnit"), top);
            descriptor2.putUnitDouble(s2t("left"), s2t("pixelsUnit"), left);
            descriptor2.putUnitDouble(s2t("bottom"), s2t("pixelsUnit"), bottom);
            descriptor2.putUnitDouble(s2t("right"), s2t("pixelsUnit"), right);
            descriptor.putObject(s2t("to"), s2t("rectangle"), descriptor2);
            executeAction(s2t("set"), descriptor, DialogModes.NO);
        }

        function whiteFill(fillOpacity) {
            var idfill = stringIDToTypeID("fill");
            var desc279 = new ActionDescriptor();
            var idusing = stringIDToTypeID("using");
            var idfillContents = stringIDToTypeID("fillContents");
            var idwhite = stringIDToTypeID("white");
            desc279.putEnumerated(idusing, idfillContents, idwhite);
            var idopacity = stringIDToTypeID("opacity");
            var idpercentUnit = stringIDToTypeID("percentUnit");
            desc279.putUnitDouble(idopacity, idpercentUnit, fillOpacity);
            var idmode = stringIDToTypeID("mode");
            var idblendMode = stringIDToTypeID("blendMode");
            var idnormal = stringIDToTypeID("normal");
            desc279.putEnumerated(idmode, idblendMode, idnormal);
            executeAction(idfill, desc279, DialogModes.NO);
        }
    }
}

Votes

Translate

Translate

Report

Report
Community Expert ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

@julieb28824091 – Unfortunately, there is no legacy Export As option for M1 Macs. You can use Rosetta or one of the other workarounds mentioned in this topic.

Votes

Translate

Translate

Report

Report
Community Expert ,
Apr 17, 2022 Apr 17, 2022

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Is a permanent solution for this problem still in the works? We are exporting assets for games, and it's really important to have control over how a layer is placed within the canvas in that case. The assets are often not centered. The legacy export options work, but a proper solution would be much better of course.

Votes

Translate

Translate

Report

Report
Contributor ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

I certainly hope a solution is in the works.   My needs are the same as yours.

Votes

Translate

Translate

Report

Report
Community Beginner ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

Still no fix for this, Adobe? This really messes with our workflow here. We have to be able to export multiple Layer(folders) to PNG files while keeping control over the file size (in pixels) of those exports. That was possible by applying a mask to those layers to determine the size. 

 

We can not use the size of the canvas or art boards as suggested because the exports all need to have different sizes. Creating an artboard for each individual image would be crazy.

 

Please fix this.

Votes

Translate

Translate

Report

Report
Community Beginner ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

LATEST

And another thing. This article explains You could alter the canvas size while exporting to have some control on the output size: https://helpx.adobe.com/photoshop/using/export-artboards-layers.html

 

Scherm­afbeelding 2024-03-21 om 11.17.55.png

But when I try this with an image inside an art board (so not just the canvas), the export window crashes.

Votes

Translate

Translate

Report

Report