
Stephen Marsh
Community Expert
Stephen Marsh
Community Expert
Activity
Mar 01, 2025
01:58 AM
This is the challenge of using Photoshop or rasterize presumably live text/vector content.
You can try grayscale mode if colour isn't critical which is 1/3 the file size of RGB.
Even better would be bitmap mode, which would allow higher resolution and better lossless compression, however, I'm not sure if this mode is supported by PDF Presentation to create a multi page PDF.
A native PDF tool would be better for the task.
... View more
Mar 01, 2025
01:52 AM
You can use the shift key modifier when dragging to "pin register" them together if they are the same pixel dimensions (middle centre aligned).
You can also use the Layer > Duplicate command to dupe selected layer/s or groups between documents.
... View more
Feb 28, 2025
08:14 PM
2 Upvotes
I don't think I've ever needed a blank document the size of the clipboard. I very frequently want the clipboard to open in Photoshop. Why should I enter a keystroke to avoid something I never want?
@Semaphoric
I was specifically replying to the comment regarding GIMP having a "New Layer from Clipboard" when Photoshop doesn't. This is an extension of the OT where it was about a new document from the clipboard.
Creating a new layer from the clipboard is as simple as a single paste command, so is this just semantics? Do we really need a new, separate menu item to paste clipboard content as a new layer when we can just paste the clipboard content using an existing single command?
Creating a new document from the clipboard takes multiple steps, which makes more sense for a new command, outside of DIY actions/scripts which can be triggered using a single command.
... View more
Feb 28, 2025
07:21 PM
Hello Stephen,
Thanks for your reply. When running the crop command as a recorded action is missing its crop handles in every verson of Photoshop after version 25.11. Zooming, showing extras, or any other movements are not available when running actions. Please consider that the crop command is not the only command running in the recorded script.
By @marcdwelis
Well, I naturally assumed that you had the modal control active on the action step for an interactive crop.
Anyway, I downloaded Photoshop 2025 and had no problems with cropping with a modal control active, the handles were there.
I played around with the gear/cog icon and turned classic mode on and off and crop shield etc... Then I lost the handles!
Resetting prefs on quit didn't fix things.
Running the modal action step, and going to the gear/cog icon and turning classic mode on and off and crop shield on and off etc. didn't fix anything.
I exited the action.
Next, I manually used the crop tool without using the action, again playing with the various options and my crop handles returned! The next time I ran the modal action, it was reset and the handles were again visible.
Hope this works for you!
... View more
Feb 28, 2025
06:36 PM
1 Upvote
@Raster_Eyes wrote:
So is New Layer from Clipboard.
In all seriousness, what is wrong with Ctrl/Cmd + V to paste in a new layer? It's a single command.
With a new doc from clipboard, it's Ctrl/Cmd + N plus OK plus Ctrl/Cmd + V – so three steps minimum, perhaps four or more if you want to clean up the layers.
I created a script for new document from keyboard as there were multiple steps, so apart from paste, what would new layer from clipboard actually need? Revealing the canvas if the new layer content was larger? Aligning the new layer to the canvas if the default upper left wasn't desired? What else?
... View more
Feb 28, 2025
06:21 PM
Done. Thank you so much for everything.
By @Suraiya A
Thank you and you're welecome!
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 28, 2025
04:56 PM
1 Upvote
Feb 28, 2025
04:56 PM
1 Upvote
Hard to comment as the image upload is incomplete. One possible "out of the box" option:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/jpeg-with-outline-path-to-transparent-png-files-conversion/m-p/13055741#U13071607
https://www.marspremedia.com/download-confirmed?asset=batch-web-images.zip
https://www.marspremedia.com/software/photoshop/batch-web-images
https://m.youtube.com/watch?v=Fes9ApyIMhM
Otherwise, record an action using Select Subject and adding a mask or otherwise clearing the background of a floating layer, then run via Batch, Image Processor etc.
... View more
Feb 28, 2025
04:27 PM
Perhaps you have mistakenly set Script Events Manager already, but to create a layer from Background (there is a script for this that ships with Photoshop).
... View more
Feb 28, 2025
02:27 PM
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 to height contrast edges. This could all be automated/semi-automated into an action.
I haven't tested, but the Camera Raw Filter sharpening has an edge mask feature and it may support negative values.
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 28, 2025
01:49 PM
1 Upvote
Feb 28, 2025
01:49 PM
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
Feb 28, 2025
03:58 AM
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
Feb 28, 2025
03:13 AM
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
Community Expert
in Photoshop ecosystem Discussions
Feb 28, 2025
03:08 AM
2 Upvotes
Feb 28, 2025
03:08 AM
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
10:33 PM
Not prompted as expected: empty
By @javaer
While you are waiting for @c.pfaffenbichler you can try the script that I posted.
... View more
Community Expert
in Photoshop ecosystem Discussions
Feb 27, 2025
10:12 PM
2 Upvotes
Feb 27, 2025
10:12 PM
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
02:57 PM
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 cycle over all or selected 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