Skip to main content
Participant
August 24, 2021
Answered

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

  • August 24, 2021
  • 36 replies
  • 10994 views

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.


 

Correct answer PECourtejoie

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

36 replies

radmirsharipov
Participant
November 22, 2021

Hello there,
There are some problems with exporting layers as png.
Before PNGs were saved with the mask area, but now they are exported cropped.
Working on Macbook m1, I don't have this problem on my another laptop- Macboo pro i9 late 2019
Have you faced such a problem?


Tarun Saini
Community Manager
Community Manager
November 22, 2021

Hi there,

 

We're sorry about the trouble with Photoshop. Would you mind telling us the version of Photoshop you're using?

Since when have you been facing this issue? Which color mode you are into? Are you getting any errors?

 

What happens when you click on "Quick Export as PNG"?

Try resetting the preferences of Photoshop: https://helpx.adobe.com/photoshop/using/preferences.html

Backup the preferences prior to resetting by:https://helpx.adobe.com/photoshop/using/preferences.html#BackupPhotoshoppreferences

 

Let us know if that helps.

 

Regards,

Tarun

 

radmirsharipov
Participant
November 23, 2021

Hey
I don't remember exactly when it happened. But there is a feeling that after I connected the Wacom Cintiq to the laptop. (I used it for a week, I'm not sure if it could somehow affect photoshop)
There is no errors. Color settings in attachment.
I've been resetting and reinstalling photoshop already.
Photoshop version 23.0.1
macOs Big Sur 11.5.1
Macbook Air M1 (2020)

I think I found a pattern.
If mask crosses over layer content png exports as it should but if layer content is inside mask area and not touching mask borders then layer exports just cropped in his original form.
I hope I am clear and the problem is understandable. Since I am not a native english speaker.

Stephen Marsh
Community Expert
Community Expert
September 22, 2021

Hopefully the following script will suffice as a short term work-around. An action can also do similar. I also agree that this is a step backwards, not forwards and that having to come up with work-arounds is far from ideal.

 

/*
Transparency Bounding Pixels.jsx
Stephen Marsh
Version 1, 22nd September 2021
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 can be filled!

https://community.adobe.com/t5/photoshop-ecosystem-discussions/export-as-now-crops-to-contents-instead-of-using-the-mask/td-p/12336888
Export As now crops to contents instead of using the mask
*/

#target photoshop

if (documents.length) {

    // Main script
    function main() {
        var origRuler = app.preferences.rulerUnits;
        app.preferences.rulerUnits = Units.PIXELS;

        var docWidth = app.activeDocument.width.value;
        var docHeight = app.activeDocument.height.value;

        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();

        app.preferences.rulerUnits = origRuler;
    }

    app.activeDocument.suspendHistory("Run script", "main()");


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

    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);
    }

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

 

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

Jeff Arola
Community Expert
Community Expert
September 21, 2021

posted in wrong thread

Participating Frequently
August 26, 2021

If there is any transparent pixel it will be turned into white pixel.

BrettN
Community Manager
Community Manager
August 24, 2021

The new Export As will ignore all fully transparent pixels. Using a mask to add "white space" around an object wouldn't work in this context. The best way to approach what you are trying to accomplish is to use the Cavas Size settings within the Export As dialog. In your screen shot, the current settings are 165x165, the size of the circle. You can simply set this to 512x512 and you would get the desired effect. 

jpt7765Author
Participant
August 26, 2021

Thank you! That is a good point and good to know.

Unfortunately editing canvas in that dialog adds space equally around the content image, so it is unusable as it is then uncontrollable how the content is placed inside the image space. If any changes were made to content shape that would edit the whole position when exported (would break for example icons and such).

Also point is to have the size determined in the group mask so anyone using the PSD can just export the image correctly without further tweaking of numeral values.

jpt7765Author
Participant
August 24, 2021

Preview image explaining the issue