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

automatic unsharp mask

Advocate ,
Aug 13, 2017 Aug 13, 2017

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

TOPICS
Actions and scripting
1.2K
Translate
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 1 Correct answer

Community Expert , Aug 13, 2017 Aug 13, 2017

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

...
Translate
Adobe
Community Expert ,
Aug 13, 2017 Aug 13, 2017

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);

};

Translate
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
Advocate ,
Aug 13, 2017 Aug 13, 2017
LATEST

Really great

Just what I was looking for

Thank you

Translate
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