Skip to main content
Participant
June 3, 2024
Answered

Simple JSX scritpt to applu Gaussian Blur in PS

  • June 3, 2024
  • 4 replies
  • 960 views

Hi Everyone!

 

I'm trying to make a script to apply gaussian blur to the entire image, but I was unable to select the layer and apply the filter to the layer.

app.activeDocument.activeLayer = app.activeDocument.layers[0];
app.activeDocument.activeLayer.hasSelectedArtwork = true;
app.activeDocument.activeLayer.applyGaussianBlur(150.0);

I got a window alert with the message: "The command "Gaussian Blur" is not currently available" as seen in the attached image

 

Thanks for your help!


Marcio

Correct answer pixxxelschubser

Yes.

 

@mslino65 

And for the beginning:
This code snippet opens in Photoshop the dialogue for the Gaussian blur with the value specified in the script.

 

app.displayDialogs = DialogModes.ALL;
app.activeDocument.activeLayer.applyGaussianBlur(30);

 

 

4 replies

Participant
June 4, 2024

 

Ensure the layer is selected:

app.activeDocument.activeLayer = app.activeDocument.layers[0];

 

Check if the layer is visible and unlocked:

app.activeDocument.activeLayer.visible = true;
app.activeDocument.activeLayer.allLocked = false;

 

Apply the Gaussian Blur:

app.activeDocument.activeLayer.applyGaussianBlur(150.0);

If the issue persists, verify that the active layer is an image layer and not a text or adjustment layer, as the Gaussian Blur filter may not be applicable to these.

For More Check Here: [Link removed]


[ unverified link removed by moderator for security reasons ]

[ In case of repetition, the post will be marked as spam.]

pixxxelschubser
Community Expert
Community Expert
June 4, 2024

Are you in the right forum?

Is this really a Photoshop script question?

Was the script created by yourself or by ChatGPT?


Because ‘hasSelectedArtwork’ is part of the Illustrator DOM.

c.pfaffenbichler
Community Expert
Community Expert
June 4, 2024
quote

Because ‘hasSelectedArtwork’ is part of the Illustrator DOM.

Ahh! That explains it … 

 

But the method »applyGaussianBlur« exists in Photoshop’s DOM. 

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
June 4, 2024

Yes.

 

@mslino65 

And for the beginning:
This code snippet opens in Photoshop the dialogue for the Gaussian blur with the value specified in the script.

 

app.displayDialogs = DialogModes.ALL;
app.activeDocument.activeLayer.applyGaussianBlur(30);

 

 

c.pfaffenbichler
Community Expert
Community Expert
June 4, 2024

Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible? 

 

What is »hasSelectedArtwork« supposed to be? 

Though photoshop-javascript-ref-2020.pdf is obviously not up to date I don’t know a newer version and I failed to find a reference to the property there. 

Inspiring
June 3, 2024

sorry you selected the background layer, Does the background layer have a lock?