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

Scripting error trying to apply Displace filter

New Here ,
Jan 03, 2025 Jan 03, 2025

Copy link to clipboard

Copied

I keep running into the following error trying to apply the Displace filter via a script as part of a larger scripted workflow. 

 

"Error processing mockup u1787985226_A_BellaCanvas_3001_t-shirt_hanging_on_a_hanger._Beh_92da5d11-2f44-46e4-bda7-e206af536b6a.psd: Failed to apply Displace filter: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.

- The command “<unknown>” is not currently available."

 

Does anyone know where I can find documentation or direction on how to do this? I'm using Photoshop 2025 on a Mac, and I know the function is there because it's available in the dropdown Filters menu, and I've successfully applied it manually. But I'd like to apply it with a script to make bulk editing easier.

 

I've attached my entire script if anyone can review and comment.

TOPICS
Actions and scripting , macOS

Views

95

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
community guidelines
Adobe
New Here ,
Jan 03, 2025 Jan 03, 2025

Copy link to clipboard

Copied

I'm very new to scripting and don't have any experience with coding, so forgive me if my question is obvious, and if my code is ugly... 

Votes

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
community guidelines
Community Expert ,
Jan 03, 2025 Jan 03, 2025

Copy link to clipboard

Copied

@KillenH 

 

Did you use AI to generate the code?

Votes

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
community guidelines
New Here ,
Jan 03, 2025 Jan 03, 2025

Copy link to clipboard

Copied

Lol yeah I had copious amounts of help from GitHub copilot. That obvious, huh? But do you have any helpful guidance?

Votes

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
community guidelines
Community Expert ,
Jan 03, 2025 Jan 03, 2025

Copy link to clipboard

Copied

LATEST

@KillenH 

 

Does the script otherwise work if you comment out or remove the displace function call, or swap it for the code below?

 

To begin, do a global find/replace and change all instances of const to var

 

Or feed the generated code back into AI and tell it to make it compatible with Photoshop ExtendScript and not generic JavaScript.

 

Curiously, the AI generated code uses ActionManager code for the displce filter, rather than the more common DOM code:

 

 

/* https://theiviaxx.github.io/photoshop-docs/Photoshop/ArtLayer/applyDisplace.html */

// DisplacementMapType.TILE;
// UndefinedAreas.WRAPAROUND

app.activeDocument.activeLayer.applyDisplace(10, 10, DisplacementMapType.STRETCHTOFIT, UndefinedAreas.REPEATEDGEPIXELS, displacementMapPath.fsName);

 

 

Votes

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
community guidelines