Copy link to clipboard
Copied
I have an action where I run a Gaussian Blur 3 times on 3 separate layers. The first blur I have to manually choose based on the image how much blur to set. For the second blur, it is half of the first. For the third, it is half of the second. Is there a way to script in the second and third blurs so they can automatically be applied? Basically, is there a way to grab the amount of blur added to a layer with a script so I can use it in subsequent blurs? Or, can anyone think of a workaround for this?
Part of the issue is that I never know before running the GB dialog how much blur I need to add. It is adjusted based on how it looks.
These functions should let you do want you need.
function getUserGaussianBlur() {
var res = -1;
try{
desc = executeAction( charIDToTypeID('GsnB'), undefined, DialogModes.ALL );
if(desc.hasKey(charIDToTypeID('Rds '))){
res = desc.getUnitDoubleValue(charIDToTypeID('Rds '));
}
}catch(e){}
return res;
}
function gaussianBlur( blur ) {
if( blur != undefined ){
try{
var desc = new ActionDescriptor();
desc.putUnitDouble( charIDToT
Copy link to clipboard
Copied
These functions should let you do want you need.
function getUserGaussianBlur() {
var res = -1;
try{
desc = executeAction( charIDToTypeID('GsnB'), undefined, DialogModes.ALL );
if(desc.hasKey(charIDToTypeID('Rds '))){
res = desc.getUnitDoubleValue(charIDToTypeID('Rds '));
}
}catch(e){}
return res;
}
function gaussianBlur( blur ) {
if( blur != undefined ){
try{
var desc = new ActionDescriptor();
desc.putUnitDouble( charIDToTypeID('Rds '), charIDToTypeID('#Pxl'), blur );
executeAction( charIDToTypeID('GsnB'), desc, DialogModes.NO );
}catch(e){}
}
}
var b = getUserGaussianBlur();
alert( b );
if( b != -1 ) gaussianBlur( b/2 );
Copy link to clipboard
Copied
Perfect. Once again, thank you Michael.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now