Copy link to clipboard
Copied
What if we set the pixel ratio? For example, 1000x1000 pixel is Blur 3 radius pixels. 2000x2000 pixel is blur 6 radius pixels. If it's 1500x1500 pixels, can you make scripts to add how much blur radius... Before clicking the scripts, I'll set the selection with rectangular marquee tools and how many pixels to set.
@Thiha31203570tbl0 – Is this related to your similar post below?
If performing frequency separation, it is normally done on the entire canvas, not a selection. It can always be masked afterwards.
// 2023, use it at your own risk;
if (app.documents.length > 0) {
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
if (hasSelection() == true) {
var theBounds = activeDocument.selection.bounds;
var theWidth = theBounds[2] - theBounds[0];
var theHeight = theBounds[3] - theBounds[1];
var theValue = Math.max(theWidth, theHeight) * 0.003;
gaussianBlur (theValue)
};
app.preferences.rulerUnits =
...
Copy link to clipboard
Copied
Are you looking for help with scripting? I will tag few experts who can help you @c.pfaffenbichler @Stephen_A_Marsh
Copy link to clipboard
Copied
You can use the bounds of the active Selection to determine its width and height and then calculate the Filter-value.
But what about non-square Selections? How exactly should those influence the target-value?
Copy link to clipboard
Copied
// 2023, use it at your own risk;
if (app.documents.length > 0) {
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
if (hasSelection() == true) {
var theBounds = activeDocument.selection.bounds;
var theWidth = theBounds[2] - theBounds[0];
var theHeight = theBounds[3] - theBounds[1];
var theValue = Math.max(theWidth, theHeight) * 0.003;
gaussianBlur (theValue)
};
app.preferences.rulerUnits = originalRulerUnits;
};
////// gausiian blur //////
function gaussianBlur (value) {
try {
var idGsnB = charIDToTypeID( "GsnB" );
var desc4 = new ActionDescriptor();
var idRds = charIDToTypeID( "Rds " );
var idPxl = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( idRds, idPxl, value );
executeAction( idGsnB, desc4, DialogModes.NO );
app.refresh();
} catch (e) {}
};
////// check for selection //////
function hasSelection(){
var ref10 = new ActionReference();
ref10.putProperty(stringIDToTypeID("property"), stringIDToTypeID("selection"));
ref10.putEnumerated( charIDToTypeID( "Dcmn" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
var docDesc = executeActionGet(ref10);
return docDesc.hasKey(stringIDToTypeID("selection"));
};
Copy link to clipboard
Copied
@c.pfaffenbichler – that's some pretty good voodoo you have there!
var theValue = Math.max(theWidth, theHeight) * 0.003;
I would have used a whole lot of if/else or other conditionals, which isn't as elegant as your approach!
Copy link to clipboard
Copied
But does it make sense in this process?
It would give the same result for a Selection of 1000px x 10px and a Selection of 1000px x 1000px.
Copy link to clipboard
Copied
Perhaps not!
But it makes as much sense as a one size fits all frequency separation based on pixel dimensions rather than unique image content and further editing requirements.
Copy link to clipboard
Copied
i need this scripts. Thank you so much sir
Copy link to clipboard
Copied
If I want to replace Gaussian Blur with Highpass, how can I fix it in the scripts?
Copy link to clipboard
Copied
You needn’t use AM-code, DOM-code offers the method applyHighPass (edit: for ArtLayer)
Copy link to clipboard
Copied
Is it possible to modify some places in the notepad in the scripts written by Sir? I want to replace the Gaussian Blur with a highpass or something
Copy link to clipboard
Copied
Replace the line
gaussianBlur (theValue)
with
activeDocument.activeLayer.applyHighPass(theValue)
Copy link to clipboard
Copied
Thank you so much sir !
Copy link to clipboard
Copied
@Thiha31203570tbl0 – Is this related to your similar post below?
If performing frequency separation, it is normally done on the entire canvas, not a selection. It can always be masked afterwards.
Copy link to clipboard
Copied
@Stephen A Marsh ... Yes bro ... I want to Creat Skin smoothness automatically Action
Copy link to clipboard
Copied
There are no magic numbers, although resolution plays a part, it is all about the level of detail that is required in the HF layer vs. the LF layer.
Copy link to clipboard
Copied
Yes, gaussian blur radius is not a magic number. . . But in order to separate the image from the low layer and the high layer, we have to adjust the gaussian blur radius again.
For example, in a 4000x6000 pixel image, a close-up face image is blurred by adding a blur radius more than normal when dividing the lw layer vs high layer.
If that 4000x6000 image has a full body image, the blur number should be used a little bit. thank you sir