
Stephen Marsh
Community Expert
Stephen Marsh
Community Expert
Activity
10m ago
I'd dupe the layer, blur it enough to reduce (Gaussian, Median or whatever works), change the layer blend mode to darken, apply a midtone adjustment to lighten slightly and or playing with blend if sliders. Finally, creating an "edge mask" using find edges filter, or glowing edges filter or a custom convolution filter matrix is another option to isolate the darkening of the halos. This could all be automated/semi-automated into an action.
... View more
49m ago
1 Upvote
What is going on with development, HELLO.
By @Da Buzz
What is going on with user, HELLO.
Seriously though, the devs did add a feature to work around users trying to create PNG files with incompatible bit depths and colour modes, it's called Export As.
... View more
11 hours ago
Yes, yes it did.
By @Suraiya A
Then please mark my reply with the code as a correct answer.
You can either add double forward slashes // to the beginning of that line to "comment out" and disable the line of code that is erroring, or just delete that line of code.
... View more
11 hours ago
Hi, Thank you so much for this kindness. I run the script. I am getting an eror. Kindly take a look please. I am using photoshop 23.
By @Suraiya A
That looks like a visibility issue with the code in your version, I think that I created and tested in Photoshop 2021. Apart from that error, it did make all of the unlocked layers gray based on the red channel content didn't it?
... View more
11 hours ago
2 Upvotes
Yes - but let's not confuse the issue with facts 😉
There's a second term of office proving that point daily!
The point is that the RGB numbers don't change.
By @D Fosse
If the source document is RGB mode, then yes, I agree! 😉
... View more
Feb 27, 2025
Not prompted as expected: empty
By @javaer
While you are waiting for @c.pfaffenbichler you can try the script that I posted.
... View more
Feb 27, 2025
2 Upvotes
@OurGazebo
The Script Events Manager can be used to automate this via an action or script tied to the open event.
https://prepression.blogspot.com/2021/10/photoshop-script-events-manager.html?m=1
... View more
Feb 27, 2025
AppleScript coders are few and far between here.
This is certainly possible via cross platform JS/ES and AS can run JS.
One doesn't need IPP to save JPEGs, that is possible using a "headless" script.
... View more
Feb 27, 2025
12:59 PM
Why do you need to use Image Processor Pro, which presumably throws up an interface requiring manual attention, which would interrupt an automated workflow?
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 27, 2025
12:54 PM
1 Upvote
Feb 27, 2025
12:54 PM
1 Upvote
Assign Profile does not change any numbers. That's the whole point.
By @D Fosse
The document mode values do not change, on that we can all agree. The Lab and other derived values will change, unless the profile being assigned is essentially the same as the current profile.
... View more
Feb 27, 2025
12:50 PM
Edit: Oh, do you need to animate each layer separately? If you do, my method won’t work because it will flatten the file, so we’ll have to find another way.
By @Conrad_C
The script that I created for @Suraiya A will cylce over all unlocked layers and convert them to a smart object and apply a R=100% monochromatic channel mixer. It's easy enough to remove the smart object line of code to simplify the file if working on a copy of the original.
... View more
Feb 27, 2025
02:48 AM
Thank you so much. I will try it. I am grateful to you for this post link.
By @Suraiya A
You're welcome!
Here is a custom script for you, no adjustment layer is necessary, the grayscale conversion will use the red channel. Updated to a 1.1 version using smart objects/smart filters.
Press "Yes" to process ALL layers or "No" to process only the selected/active layers.
Note: Locked layers are skipped, although that is easily changed if you wish for the script to automatically unlock them.
/*
Layers to Gray Based on Red Channel.jsx
Stephen Marsh
v1.0 - 27th February 2025
v1.1 - Adds a smart object / smart filter for lossless conversion of colour to gray
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-can-i-convert-color-into-this-format/td-p/15179655
Note: Locked layers are skipped
*/
#target photoshop
// Ensure a document is open
if (app.documents.length > 0) {
if (app.activeDocument.mode == DocumentMode.RGB) {
// Single history stage undo
activeDocument.suspendHistory("Undo Script", "main()");
function main() {
// Layer selection logic
if (confirm("Process all layers (Yes), or only process the selected layers (No)?", false)) {
selectAllLayers();
}
// Capture the initial layer visibility and layer selection
var currentLayersState = getLayersVisiblity();
// Get the selected layers: courtesy of 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();
// Loop over the selected layers: courtesy of jazz-y
for (var l = 0; l < lrs.count; l++) {
sel.putIdentifier(s2t('layer'), p = lrs.getReference(l).getIdentifier(s2t('layerID')));
(r = new ActionReference()).putIdentifier(s2t('layer'), p);
(d = new ActionDescriptor()).putReference(s2t("target"), r);
//d.putBoolean(s2t("makeVisible"), false);
executeAction(s2t('select'), d, DialogModes.NO);
// Check if the layer is locked
if (isLayerLocked()) {
//app.activeDocument.activeLayer.allLocked = false; // Unlock the layer
continue; // Skip processing this layer if it is locked
}
// Create a new embedded smart object from the selected layers
executeAction(stringIDToTypeID("newPlacedLayer"), undefined, DialogModes.NO);
// Process the active layer
channelMixer();
}
// Restore the initial layer visibility and selection
setLayersVisiblity(currentLayersState);
}
} else {
alert("The document must be RGB mode!");
}
} else {
alert("A document must be open!");
}
///// Functions /////
function selectAllLayers(ignoreBackground) {
// Should be pretty snappy since it uses the native 'Select > All Layers' method and then adds background layer if it exists.
// selectAllLayers(true); // Ignores background layer
// Select all layers (doesn't include Background)
try {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt'));
desc.putReference(charIDToTypeID('null'), ref);
executeAction(stringIDToTypeID('selectAllLayers'), desc, DialogModes.NO);
} catch (e) { }
if (!ignoreBackground) {
// Add Background Layer to the selection (if it exists)
try {
activeDocument.backgroundLayer;
var bgID = activeDocument.backgroundLayer.id;
var ref = new ActionReference();
var desc = new ActionDescriptor();
ref.putIdentifier(charIDToTypeID('Lyr '), bgID);
desc.putReference(charIDToTypeID('null'), ref);
desc.putEnumerated(stringIDToTypeID('selectionModifier'), stringIDToTypeID('selectionModifierType'), stringIDToTypeID('addToSelection'));
desc.putBoolean(charIDToTypeID('MkVs'), false);
executeAction(charIDToTypeID('slct'), desc, DialogModes.NO);
} catch (e) { }
}
}
function channelMixer() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor.putEnumerated(s2t("presetKind"), s2t("presetKindType"), s2t("presetKindCustom"));
descriptor.putBoolean(s2t("monochromatic"), true);
descriptor2.putUnitDouble(s2t("red"), s2t("percentUnit"), 100);
descriptor.putObject(s2t("gray"), s2t("channelMatrix"), descriptor2);
executeAction(s2t("channelMixer"), descriptor, DialogModes.NO);
}
function getLayersVisiblity() {
// by jazz-y
var s2t = stringIDToTypeID,
t2s = typeIDToStringID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var targetLayers = executeActionGet(r).getList(p),
seletion = [],
visiblity = {};
for (var i = 0; i < targetLayers.count; i++) seletion.push(targetLayers.getReference(i).getIdentifier());
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('numberOfLayers'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var len = executeActionGet(r).getInteger(p);
for (var j = 1; j <= len; j++) {
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('layerSection'));
r.putIndex(s2t('layer'), j);
if (t2s(executeActionGet(r).getEnumerationValue(p)) == 'layerSectionEnd') continue;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('layerID'));
r.putIndex(s2t('layer'), j);
var id = executeActionGet(r).getInteger(p);
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('visible'));
r.putIndex(s2t('layer'), j);
var visible = executeActionGet(r).getBoolean(p);
visiblity[id] = visible;
}
return {
selection: seletion,
visiblity: visiblity
};
}
function setLayersVisiblity(layersStateObject) {
// by jazz-y
var s2t = stringIDToTypeID;
for (var a in layersStateObject.visiblity) {
makeVisible = layersStateObject.visiblity[a] ? "show" : "hide";
(r = new ActionReference()).putIdentifier(s2t('layer'), a);
(d = new ActionDescriptor()).putReference(s2t('target'), r);
executeAction(s2t(makeVisible), d, DialogModes.NO);
}
if (layersStateObject.selection.length) {
var r = new ActionReference();
for (var i = 0; i < layersStateObject.selection.length; i++)
r.putIdentifier(s2t("layer"), layersStateObject.selection[i]);
(d = new ActionDescriptor()).putReference(s2t("target"), r);
d.putBoolean(s2t("makeVisible"), false);
executeAction(s2t("select"), d, DialogModes.NO);
} else {
(r = new ActionReference()).putEnumerated(s2t("layer"), s2t('ordinal'), s2t('targetEnum'));
(d = new ActionDescriptor()).putReference(s2t('target'), r);
executeAction(s2t('selectNoLayers'), d, DialogModes.NO);
}
}
function isLayerLocked() {
var s2t = stringIDToTypeID;
var ref = new ActionReference();
ref.putProperty(s2t('property'), s2t('layerLocking'));
ref.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
var desc = executeActionGet(ref).getObjectValue(s2t('layerLocking'));
return desc.getBoolean(s2t('protectAll')) || desc.getBoolean(s2t('protectComposite'));
}
Copy the code text to the clipboard
Open a new blank file in a plain-text editor (not in a word processor)
Paste the code in
Save as a plain text format file – .txt
Rename the saved file extension from .txt to .jsx
Install or browse to the .jsx file to run (see below)
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 27, 2025
12:47 AM
1 Upvote
Feb 27, 2025
12:47 AM
1 Upvote
One could load the Transparency and intersect with the Layer Mask …
By @c.pfaffenbichler
Cool! I looked at loading the transparency, which fires a warning when performing without scripting, but didn't think of qualifying this against the mask!
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 27, 2025
12:45 AM
1 Upvote
Feb 27, 2025
12:45 AM
1 Upvote
I looked at the code in the link, that is for the entire document, I hope to check a certain layer
By @javaer
Too bad that it's impossible to duplicate the active layer to a new document, check the histo and then close the temp doc without saving. :]
EDIT: Joking aside, here is what I was referring to, I ended up using mean rather than std. dev.
/*
Alert Visible Pixels In The Active Layer.jsx
Stephen Marsh
v1.0 - 27th February 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/use-a-script-to-check-if-a-layer-with-a-layer-mask-applied-has-visible-content/td-p/15180227
*/
#target photoshop
if (app.documents.length > 0) {
if (isLayerMaskEnabled()) {
// Set the active layer name
var theLayerName = app.activeDocument.activeLayer.name;
// Duplicate the active layer to a temporary document
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
var reference2 = new ActionReference();
reference.putClass(s2t("document"));
descriptor.putReference(s2t("null"), reference);
descriptor.putString(s2t("name"), "tempDoc");
reference2.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
descriptor.putReference(s2t("using"), reference2);
descriptor.putString(s2t("layerName"), theLayerName);
descriptor.putInteger(s2t("version"), 5);
executeAction(s2t("make"), descriptor, DialogModes.NO);
// Select the mask channel
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated(s2t("channel"), s2t("channel"), s2t("mask")); // or "RGB"
descriptor.putReference(s2t("null"), reference);
descriptor.putBoolean(s2t("makeVisible"), false);
executeAction(s2t("select"), descriptor, DialogModes.NO);
// Apply the layer mask
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated(s2t("channel"), s2t("ordinal"), s2t("targetEnum"));
descriptor.putReference(s2t("null"), reference);
descriptor.putBoolean(s2t("apply"), true); // or false
executeAction(s2t("delete"), descriptor, DialogModes.NO);
/*
Based on:
https://community.adobe.com/t5/photoshop/how-to-get-the-histogram-s-std-dev/td-p/9875041
*/
if (app.documents.length > 0 && activeDocument.mode == DocumentMode.RGB) {
var theR = histogramMeanStandardDeviation(activeDocument.channels[0].histogram);
var theG = histogramMeanStandardDeviation(activeDocument.channels[1].histogram);
var theB = histogramMeanStandardDeviation(activeDocument.channels[2].histogram);
// theMean = [0] | theMedian = [1] | theStandDev = [2]
var theMean = Number(((theR[0] + theG[0] + theB[0]) / 3));
// Alert the results!
if (theMean === 255) {
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
alert("There are no visible pixels in the active layer!");
// Do something here...
} else {
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
alert("There are visible pixels in the active layer!");
// Do something else here...
}
}
////// get mean of histogram //////
function histogramMeanStandardDeviation(theHist) {
// get total number;
var thePixels = 0;
for (var m = 0; m < theHist.length; m++) {
thePixels = thePixels + theHist[m];
}
// get mean and median;
var theMean = 0;
var aTotal = 0;
var check = false;
for (var n = 0; n < theHist.length; n++) {
theMean = theMean + (n * theHist[n] / thePixels);
aTotal = aTotal + theHist[n];
if (aTotal >= thePixels / 2 && check === false) {
theMedian = n;
check = true;
}
}
// get standard deviation;
var theStandDev = 0;
for (var o = 0; o < theHist.length; o++) {
theStandDev = theStandDev + (Math.pow((o - theMean), 2) * theHist[o]);
}
theStandDev = Math.sqrt(theStandDev / thePixels);
// theMean = [0] | theMedian = [1] | theStandDev = [2]
return ([theMean, theMedian, theStandDev]);
}
} else {
alert("The active layer mask is not enabled... Script aborted!");
}
} else {
alert("No document is open.");
}
function isLayerMaskEnabled() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var ref = new ActionReference();
ref.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
var desc = executeActionGet(ref);
return desc.hasKey(s2t("userMaskEnabled")) && desc.getBoolean(s2t("userMaskEnabled"));
}
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 26, 2025
11:20 PM
1 Upvote
Feb 26, 2025
11:20 PM
1 Upvote
You should be able to automate the check for no pixels using histogram evaluation for standard deviation = 0, however, automating Export As may be harder (unless something has changed that I missed).
https://community.adobe.com/t5/photoshop/how-to-get-the-histogram-s-std-dev/td-p/9875041
... View more
Feb 26, 2025
11:10 PM
@Suraiya A wrote:
Hello, Thank you so much. I dnt want to merge layers. I want all those layers to be in the same shade as it is in R channel only. I cant animate layers in after effects with a adjustment layer above them. I think I have to apply grayscale mode. Thank you so much for your kind reply.
Using an adjustment layer such as the channel mixer, a script can apply the adjustment layer to all layers, retaining the individual layers (work on a duplicate in case you need to go back to the colour version):
https://community.adobe.com/t5/photoshop-ecosystem-discussions/applying-adjustment-layer-to-multiple-layers/m-p/10442874#M591648
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 26, 2025
08:15 PM
1 Upvote
Feb 26, 2025
08:15 PM
1 Upvote
@johnjoeparrot
You will also find many examples by searching the forum with the keywords "selected layers”:
https://community.adobe.com/t5/forums/searchpage/tab/message?filter=location&q=selected%20layers&noSynonym=false&location=category:ct-photoshop&collapse_discussion=true
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 26, 2025
11:48 AM
1 Upvote
Feb 26, 2025
11:48 AM
1 Upvote
Artboards can have their own Guides.
By @c.pfaffenbichler
Indeed, and as artboards are a special type of layer group, one would think that this would be "simple" :]
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 25, 2025
12:51 AM
1 Upvote
Feb 25, 2025
12:51 AM
1 Upvote
What resolution are you rasterizing the PDF files?
You can view the histogram for the merged difference layers, however, for an exaggerated visual running equalize is a good approach for the action.
It might also help to only compare RGB luminosity for a single channel, or the L channel of Lab mode to avoid insignificant colour variations.
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 24, 2025
11:15 PM
1 Upvote
Feb 24, 2025
11:15 PM
1 Upvote
Hi , Did any one work on this script .
By @Chandrakanthi26574696ugut
This topic thread is around 14 years old, are your criteria the same? In it's simplest form, you only need an action, not a script. What would such a script offer? Is this only for two layers to compare in a single document? Can you screenshot the layers panel and provide any further info?
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 24, 2025
08:24 PM
1 Upvote
Feb 24, 2025
08:24 PM
1 Upvote
Why do you want a target file size of 1mb compressed, regardless of image content and pixel size?
What file format and pixel width depth for your example image of 637kb (before) vs 9mb (after)? Are you getting the file size of 9mb when opening in Photoshop (decompressing) or when saved to disk (compressed JPEG).
Are you using save as (save a copy), export as or save for web (legacy)?
The resolution PPI value is just metadata, it's the pixel width and height that is the key issue that will affect final file size on disk* when saved and viewed on disk.
*JPEG compression quality and excessive unwanted metadata will also affect final file size on disk.
... View more
Feb 24, 2025
02:26 PM
Nevermind, I figured it out... Image size was too big
By @stillwaterflyshop
Thanks for letting the forum know what the fix was! I would like to mark your reply as a correct answer, however, as a bug report it would appear to require owner or moderator permissions to do so.
... View more
Feb 24, 2025
02:16 PM
I hope a better solution can be found to distinguish between the two,
That would be for the platform reporting on the metadata for content credentials, on their wording and how much detail they show.
but no matter what I think we're all unfortunately facing a future where it's going to be increasingly more difficult to tell what's real and what's been AI-generated.
By @SK321
I think that we can all agree on that point! :]
... View more
Feb 24, 2025
03:08 AM
1 Upvote
I'm confused, you mentioned Trim and it has an option for transparent pixels?
... View more
Feb 24, 2025
01:00 AM
On the topic of generic layer-saving scripts:
https://github.com/antipalindrome/Photoshop-Export-Layers-to-Files-Fast
https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Saver.jsx
https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Saver%20Plus.jsx (as mentioned above by @Jeff Arola)
https://github.com/mechanicious/photoshopCompositionComposer
Batch: https://www.marspremedia.com/software/photoshop/save-layers
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 23, 2025
10:02 PM
1 Upvote
Feb 23, 2025
10:02 PM
1 Upvote
In addition to setting the crop options and moving the crop to the right canvas edge, another option is to use the Image > Canvas Size command with the anchor set the the right centre. One can also create and transform a selection to the desired size and position and use Image > Crop.
... View more
Feb 23, 2025
03:42 PM
@AnimeApparelStore
Does moving the smart object to the top layer need to happen every time the mockup script is run?
Or can you set this up correctly beforehand and save it into the template?
I have requested access to the linked PSDs.
Edit: I have downloaded the files, please answer the two questions above to help me to better understand the issue.
... View more
Feb 23, 2025
03:33 PM
I tried everything sugggested. It work 5 times then quit and wont work again. I have unistalled and reinstalled all adobe and photoshop files. Getting mad because I pay a lot for this software for years. Any other ideas?
By @Rodney Satonica
You are replying to a 6-year-old topic, and JJMack has sadly passed on.
Can you confirm that you have reset preferences, as these are not reset when reinstalling software (backup any custom actions, brushes etc., before resetting prefs).
https://helpx.adobe.com/au/photoshop/using/preferences.html
After resetting preferences, if this doesn't fix the issue, you might wish to consider using the "cleaner": https://helpx.adobe.com/au/creative-cloud/kb/cc-cleaner-tool-installation-problems.html
Good luck!
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 23, 2025
02:02 PM
1 Upvote
Feb 23, 2025
02:02 PM
1 Upvote
@siomosp
Here is an example using the standard file Save As dialog for JPEG.
/*
Default JPEG Save to Baseline Standard.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/save-as-jpeg-again/td-p/12650865
Stephen Marsh, 12th January 2022 - v1.0
Info: Uses the standard Photoshop interface with preset JPEG options
*/
#target photoshop
if (app.documents.length > 0) {
var docName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
try {
// Use the previously saved path
var docPath = app.activeDocument.path;
} catch (e) {
// If unsaved, prompt for save directory
var docPath = Folder.selectDialog("Unsaved base file, select the output folder:");
}
saveJPEG(10);
} else {
alert("You must have a document open!");
}
function saveJPEG(compValue) {
// Using the standard Photoshop dialog windows
var ID = function (s) {
return app.stringIDToTypeID(s);
};
var AD = new ActionDescriptor();
AD.putInteger(ID("extendedQuality"), compValue);
AD.putEnumerated(ID("matteColor"), ID("matteColor"), ID("none"));
AD.putObject(ID("as"), ID("JPEG"), AD);
AD.putPath(ID("in"), new File(docPath + "/" + docName + ".jpg"));
executeAction(ID("save"), AD, DialogModes.ALL);
}
... View more
Feb 23, 2025
03:39 AM
Here's the screenshot I mention above.
By @ali_4619
The message is referring to the original files and their name or location, not the "shortcut" or "alias" shown in Phtoshop's home screen or recent files menu, which can't be edited.
This is just a "helpful feature" to list recently opened documents and is easily broken if files are renamed or moved. This is similar to a shortcut in Windows or alias on the Mac breaking if a file is renamed or moved.
You should know where files are located and take care not to rename, move or delete them if this will create problems.
... View more