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

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

Community Beginner ,
Nov 26, 2020 Nov 26, 2020

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.

TOPICS
Actions and scripting
1.0K
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 , Nov 27, 2020 Nov 27, 2020

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.pngexpand image

 

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.

 

Translate
Adobe
Community Expert ,
Nov 26, 2020 Nov 26, 2020

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

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
Community Expert ,
Nov 27, 2020 Nov 27, 2020

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.pngexpand image

 

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.

 

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
Community Beginner ,
Nov 27, 2020 Nov 27, 2020

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

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
Community Expert ,
Nov 27, 2020 Nov 27, 2020
LATEST

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

 

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

 

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