How to add a simple filter to a layer with a script

Community Beginner ,
Nov 26, 2020

Copy link to clipboard

Copied

Hello all

 

Just getting started with scripts and JS, so I apologize if this is a dumb question.

How would I add a Gaussian Blur (amount 26) filter to my active layer using a script?

I have been experimenting but have not gotten it to work, thank you all in advance.

Adobe Community Professional
Correct answer by Stephen_A_Marsh | Adobe Community Professional

I still think looking at your current code would be best, however, without knowing where you are going wrong, the following diagram should hopefully help:

 

scripting-gblur.png

 

However, as the filter uses values in pixels, it is probably better to add further code to set pixels as the unit rather than just assume. This is probably OK for a simple filter, however, when resizing an image it pays to be specific.

 

TOPICS
Actions and scripting, How to

Views

61

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to add a simple filter to a layer with a script

Community Beginner ,
Nov 26, 2020

Copy link to clipboard

Copied

Hello all

 

Just getting started with scripts and JS, so I apologize if this is a dumb question.

How would I add a Gaussian Blur (amount 26) filter to my active layer using a script?

I have been experimenting but have not gotten it to work, thank you all in advance.

Adobe Community Professional
Correct answer by Stephen_A_Marsh | Adobe Community Professional

I still think looking at your current code would be best, however, without knowing where you are going wrong, the following diagram should hopefully help:

 

scripting-gblur.png

 

However, as the filter uses values in pixels, it is probably better to add further code to set pixels as the unit rather than just assume. This is probably OK for a simple filter, however, when resizing an image it pays to be specific.

 

TOPICS
Actions and scripting, How to

Views

62

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 26, 2020 0
Adobe Community Professional ,
Nov 26, 2020

Copy link to clipboard

Copied

Post your code, that is the best way to get feedback and learn.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 26, 2020 3
Adobe Community Professional ,
Nov 27, 2020

Copy link to clipboard

Copied

I still think looking at your current code would be best, however, without knowing where you are going wrong, the following diagram should hopefully help:

 

scripting-gblur.png

 

However, as the filter uses values in pixels, it is probably better to add further code to set pixels as the unit rather than just assume. This is probably OK for a simple filter, however, when resizing an image it pays to be specific.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 27, 2020 1
Community Beginner ,
Nov 27, 2020

Copy link to clipboard

Copied

Thank you so so much! That diagram definitely makes more sense now.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 27, 2020 1
Adobe Community Professional ,
Nov 27, 2020

Copy link to clipboard

Copied

They can be frustrating, however, they are the official references:

 

https://www.adobe.com/devnet/photoshop/scripting.html

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 27, 2020 0