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

Hi all . . .

Participant ,
Jul 31, 2023 Jul 31, 2023

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.

TOPICS
Windows

Views

1.0K

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 4 Correct answers

Community Expert , Aug 01, 2023 Aug 01, 2023

@Thiha31203570tbl0 â€“ Is this related to your similar post below?

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/frequency-separation-action/m-p/13977484

 

If performing frequency separation, it is normally done on the entire canvas, not a selection. It can always be masked afterwards.

Votes

Translate

Translate
Community Expert , Aug 01, 2023 Aug 01, 2023

 

// 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 
...

Votes

Translate

Translate
Community Expert , May 20, 2024 May 20, 2024
// 2024, 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;
        surfaceBlur (theValue, 10)
    };
    app.preferences.rulerUnits
...

Votes

Translate

Translate
Community Expert , May 25, 2024 May 25, 2024

For one thing a function that takes three arguments should be fed three arguments. 

// 2024, 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.021;
unsharpMask (120, theValue, 10)
...

Votes

Translate

Translate
Adobe
Community Expert ,
Jul 31, 2023 Jul 31, 2023

Copy link to clipboard

Copied

Are you looking for help with scripting? I will tag few experts who can help you @c.pfaffenbichler @Stephen Marsh 

Votes

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
Community Expert ,
Aug 01, 2023 Aug 01, 2023

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? 

Votes

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
Community Expert ,
Aug 01, 2023 Aug 01, 2023

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;
};
////// gaussian 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"));
};

 

Votes

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
Community Expert ,
Aug 01, 2023 Aug 01, 2023

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! 

Votes

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
Community Expert ,
Aug 01, 2023 Aug 01, 2023

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. 

Votes

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
Community Expert ,
Aug 01, 2023 Aug 01, 2023

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.

 

Votes

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
Participant ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

i need this scripts. Thank you so much sir

Votes

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
Participant ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

If I want to replace Gaussian Blur with Highpass, how can I fix it in the scripts?

Votes

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
Community Expert ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

You needn’t use AM-code, DOM-code offers the method applyHighPass (edit: for ArtLayer)

Screenshot 2023-08-02 at 14.55.55.png

Votes

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
Participant ,
Aug 02, 2023 Aug 02, 2023

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

Votes

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
Community Expert ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

Replace the line 

        gaussianBlur (theValue)

with 

activeDocument.activeLayer.applyHighPass(theValue)

Votes

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
Participant ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

Thank you so much sir !

Votes

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
Participant ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

If I want to replace Gaussian Blur with Surface Blur, how can I fix it in the scripts? 

I tried to change it, but it didn't work... please help me sir

Votes

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
Community Expert ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

You need to use the ScriptingListener plugin for legacy ExtendScript .jsx code that isn't covered by the legacy DOM... Or UXP batchPlay .psjs code if this isn't in the UXP DOM.

 

EDIT: Here it is in a function for ExtendScript:

 

surfaceBlur(5, 10);

function surfaceBlur(radius, threshold) {
	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};
	var descriptor = new ActionDescriptor();
	descriptor.putUnitDouble( s2t( "radius" ), s2t( "pixelsUnit" ), radius );
	descriptor.putInteger( s2t( "threshold" ), threshold );
	executeAction( s2t( "surfaceBlur" ), descriptor, DialogModes.NO );
}

 

 

Votes

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
Participant ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

Hello Sir @c.pfaffenbichler  If I want to replace Gaussian Blur with Surface Blur, how can I fix it in the scripts? 

I tried to change it, but it didn't work... please help me sir

Votes

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
Community Expert ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

// 2024, 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;
        surfaceBlur (theValue, 10)
    };
    app.preferences.rulerUnits = originalRulerUnits;
};
////// surface blur //////
function surfaceBlur (theRadius, theThreshold) {
try {
    var desc4 = new ActionDescriptor();
    desc4.putUnitDouble( charIDToTypeID( "Rds " ), charIDToTypeID( "#Pxl" ), theRadius );
    desc4.putInteger( charIDToTypeID( "Thsh" ), theThreshold );
executeAction( stringIDToTypeID( "surfaceBlur" ), 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"));
};

Votes

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
Participant ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

Thank You So Much Sir @c.pfaffenbichler  

Votes

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
Participant ,
May 25, 2024 May 25, 2024

Copy link to clipboard

Copied

Hello Sir @c.pfaffenbichler  

I tried to fix the scripts for Unsharp Mask but I don't know where I'm going wrong, the usharp mask scripts are unusable, please help me

 

// 2024, 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.021;
UnsharpMask (theValue)
};
app.preferences.rulerUnits = originalRulerUnits;
};
////// UnsharpMask //////
function UnsharpMask (theAmount, theRadius, theThreshold) {
try {
var desc1 = new ActionDescriptor();
desc1.putUnitDouble( charIDToTypeID( "Amnt " ), charIDToTypeID( "#Prc" ), theAmount );
desc1.putUnitDouble( charIDToTypeID( "Rds " ), charIDToTypeID( "#Pxl" ), theRadius );
desc1.putInteger( charIDToTypeID( "Thsh" ), theThreshold );
executeAction( stringIDToTypeID( "UnsharpMask" ), desc1, 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"));
};

Votes

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
Community Expert ,
May 25, 2024 May 25, 2024

Copy link to clipboard

Copied

For one thing a function that takes three arguments should be fed three arguments. 

// 2024, 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.021;
unsharpMask (120, theValue, 10)
};
app.preferences.rulerUnits = originalRulerUnits;
};
////// unsharp mask //////
function unsharpMask (amount, radius, threshold) {
var desc2 = new ActionDescriptor();
desc2.putUnitDouble( idAmnt = charIDToTypeID( "Amnt" ), charIDToTypeID( "#Prc" ), amount );
desc2.putUnitDouble( charIDToTypeID( "Rds " ), charIDToTypeID( "#Pxl" ), radius );
desc2.putInteger( charIDToTypeID( "Thsh" ), threshold );
executeAction( charIDToTypeID( "UnsM" ), desc2, DialogModes.NO);
};
////// 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"));
};

 

Votes

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
Participant ,
May 26, 2024 May 26, 2024

Copy link to clipboard

Copied

LATEST

Thank you so much for explaining so thoroughly... I understand . . . 

Thank You Sir @c.pfaffenbichler 

Votes

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
Community Expert ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

@Thiha31203570tbl0 â€“ Is this related to your similar post below?

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/frequency-separation-action/m-p/13977...

 

If performing frequency separation, it is normally done on the entire canvas, not a selection. It can always be masked afterwards.

Votes

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
Participant ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

@Stephen A Marsh ... Yes bro ... I want to Creat Skin smoothness automatically Action

 

Votes

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
Community Expert ,
Aug 01, 2023 Aug 01, 2023

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.

Votes

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
Participant ,
Aug 02, 2023 Aug 02, 2023

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

Votes

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