Copy link to clipboard
Copied
Hello
I do not know if it's possible to do what I have in mind
I use the unsharp mask filter very much
And I created an action to apply the effect
Unfortunately the sharpness is fine for photos of 6000x4000 px
When using smaller or larger photos I have to go to modify the values of the unsharp mask filter
I would like to know if there is a script that, depending on the size of the file, applies the right clarity.
Thank you
You could use if-clauses (or a switch-clause).
But if you think there are »correct« settings for the sharpening depending on image dimensions alone that would be an incorrect assumption.
...
// 2017, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = activeDocument;
var originalUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var theWidth = myDocument.width;
var theHeight = myDocument.height;
if (theWidth <= 1000) {unsharpMask (120, 1, 5
Copy link to clipboard
Copied
You could use if-clauses (or a switch-clause).
But if you think there are »correct« settings for the sharpening depending on image dimensions alone that would be an incorrect assumption.
// 2017, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = activeDocument;
var originalUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var theWidth = myDocument.width;
var theHeight = myDocument.height;
if (theWidth <= 1000) {unsharpMask (120, 1, 5)};
if (theWidth > 1000 && theWidth <= 2000) {unsharpMask (120, 2, 5)};
if (theWidth > 2000) {unsharpMask (120, 4, 5)};
app.preferences.rulerUnits = originalUnits;
};
////// unsharp mask //////
function unsharpMask (amount, radius, threshold) {
// =======================================================
var idUnsM = charIDToTypeID( "UnsM" );
var desc2 = new ActionDescriptor();
var idAmnt = charIDToTypeID( "Amnt" );
var idPrc = charIDToTypeID( "#Prc" );
desc2.putUnitDouble( idAmnt, idPrc, amount );
var idRds = charIDToTypeID( "Rds " );
var idPxl = charIDToTypeID( "#Pxl" );
desc2.putUnitDouble( idRds, idPxl, radius );
var idThsh = charIDToTypeID( "Thsh" );
desc2.putInteger( idThsh, threshold );
executeAction( idUnsM, desc2, DialogModes.NO);
};
Copy link to clipboard
Copied
Really great
Just what I was looking for
Thank you
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more