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.
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...
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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);