Skip to main content
Zesty_wanderlust15A7
Known Participant
May 20, 2021
Answered

PS Script: Fix for Wavelet Decompose.jsx?

  • May 20, 2021
  • 5 replies
  • 4843 views

Some weeks ago I noticed a retoucher had an action for "Wavelet Decompose".

At that time I didn't know it was for frequency separation (which I'm not really needing much, or mastering yet), so out of curiosity I Googled and found this script ...

 

https://github.com/coderand/photoshop

 

IIRC, it still works in PS 2019, but in my PS 21.2.4 it doesn't.

It is supposed to open a new document where it will make the requested layers. This is where it seems to get stuck in newer versions of PS...

 

I think the problem might be in this part...

var waveletDoc = app.documents.add(
  app.activeDocument.width,
  app.activeDocument.height,
  app.activeDocument.resolution,
  app.activeDocument.name + "-" + activeLayer.name + "-Wavelet",
  NewDocumentMode.RGB, DocumentFill.TRANSPARENT,
  app.activeDocument.pixelAspectRatio,
  BitsPerChannelType.SIXTEEN
);

 

If you see an obvious mismatch for newer PS versions, please suggest a change.

OTOH, I don't really need this at all (AFAIK), so don't waste your time for me... 😉

Correct answer r-bin

Remove percentages from the ruler. This is the problem.

5 replies

Kukurykus
Legend
May 20, 2021

In 22.4.1 it works.

Zesty_wanderlust15A7
Known Participant
May 20, 2021

I hadn't tested with the extra controls on it (dialog option).

 

I'm now getting this when it starts to add them on (while doc has pixel ruler) ...

 

 

I've had enough for today with this one though...

I may look into it or ask later, if I must.
TY again to all! 🙂

r-binCorrect answer
Legend
May 20, 2021

Remove percentages from the ruler. This is the problem.

Zesty_wanderlust15A7
Known Participant
May 20, 2021

That does it!! 🙂

 

You BIN there, done that? 😉

 

I usually don't have it set to that, but some of my scripts change it, and maybe interrupting one left it so.

I know how to add and reset that stuff via the script.

 

WOW!  Great catch and TYVM 🙂

Legend
May 20, 2021
The script works without errors on win7 and PS21.2.2.
You may have made a mistake while copying the script text.
 
What are the parameters of your open document?
 
 
 
Zesty_wanderlust15A7
Known Participant
May 20, 2021

Good to know, thx.

 

I am both meticulous *and* making many mistakes... 😉

I think I've literally retyped the commas now and everything 🙂

I'm using the original code with (or without) c.p's correction.  Nothing helps...

 

 

In PS 2019 it worked with anyhing.

I'm usually using fairly small pics in RGB 8-bit.

Legend
May 20, 2021

use this code of function (added try-catch)

function generateWavelets( levelCount, addExtraControls ) 
    {
    try {
        levelCount = parseInt( levelCount, 10 );
        var activeLayer = app.activeDocument.activeLayer;
    
        app.activeDocument.selection.selectAll();
    
        try { app.activeDocument.selection.copy( true ); }
        catch (e) {
            try { app.activeDocument.selection.copy(); }
            catch (e) { alert(e); }
        }
    
        var waveletDoc = app.documents.add(
            app.activeDocument.width,
            app.activeDocument.height,
            app.activeDocument.resolution,
            app.activeDocument.name + "-" + activeLayer.name + "-Wavelet",
            NewDocumentMode.RGB, DocumentFill.TRANSPARENT,
            app.activeDocument.pixelAspectRatio,
            BitsPerChannelType.SIXTEEN
            );
    
        try { app.activeDocument.suspendHistory("Wavelet", "generateDocWavelets( waveletDoc, levelCount, addExtraControls )") }
        catch(e) { alert(e); } 
        }
    catch(e) { alert(e); }     
    }

 

c.pfaffenbichler
Community Expert
Community Expert
May 20, 2021

Try 

var waveletDoc = app.documents.add(
  app.activeDocument.width,
  app.activeDocument.height,
  app.activeDocument.resolution,
  app.activeDocument.name + "-" + app.activeDocument.activeLayer.name + "-Wavelet",
  NewDocumentMode.RGB, DocumentFill.TRANSPARENT,
  app.activeDocument.pixelAspectRatio,
  BitsPerChannelType.SIXTEEN
);
Zesty_wanderlust15A7
Known Participant
May 20, 2021

Thx, but no difference, I think.

I see the Select All ants and then it stops, while it should be making a new document...

c.pfaffenbichler
Community Expert
Community Expert
May 20, 2021

Works fine here after rectifying the »activeLayer«. 

What is the error you ger?