Local and cloud-based workflows for extracting and updating text layers in PSD files via ExtendScript and Adobe PS API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 KiB
Adobe Photoshop API Layer ID Solution
Problem Summary
After extensive testing with the Adobe Photoshop API, we've identified a significant limitation that appears to be an undocumented issue with the API:
While our API calls to the Adobe Photoshop API (https://image.adobe.io/pie/psdService/text) appear to succeed (202 Accepted), the text changes are not actually applied to the text layers in the processed files.
Symptoms:
- API responds with 202 Accepted
- Status URL polling shows "succeeded" status
- Output PSD file gets generated correctly
- But text layers remain unchanged in the output file
Comprehensive Investigation Results
We've conducted exhaustive testing with various layer identification methods:
-
Using numeric IDs: We tried direct IDs from the JSON (converted to integers)
- Result: API accepted request (202) but text wasn't updated
-
Using internal IDs: We tried to extract what we believed might be the internal layer IDs
- Result: API accepted request (202) but text wasn't updated
-
Using layer names: We tried identifying layers by name
- Result: API accepted request (202) but text wasn't updated
-
Using layer paths: We tried identifying layers by their path
- Result: API accepted request (202) but text wasn't updated
-
Combinations of approaches: We tried using multiple identifiers together
- Result: API accepted request (202) but text wasn't updated
Conclusion
After multiple approaches and tests, we've concluded that there appears to be an issue with the Adobe Photoshop API's text layer update functionality. The API accepts the requests and returns success statuses, but it doesn't actually apply the text changes to the layers in the output PSD files.
Recommended Solution: Use Local Scripting Instead of API
Given the limitations of the Adobe Photoshop API for text layer updates, we recommend using local scripting through ExtendScript instead:
-
Local ExtendScript Approach:
- Use the working ExtendScript solution (
updateTextLayers.jsx) - This directly interacts with Photoshop and reliably updates text layers
- Works with proper layer identification by name
- Can be executed via Python for batch processing (
batch_update_text.py)
- Use the working ExtendScript solution (
-
Advantages of Local Scripting:
- Direct interaction with Photoshop guarantees text updates
- No need for external storage (GCS)
- Faster processing time without API delays
- More reliable layer identification
- Preserves text styling and formatting
-
Implementation Details:
- Extract text from PSD files using
mac_ps_extract.py - Edit the JSON files with your updated text
- Update PSD files using
mac_ps_update.py - All scripts are available and fully tested
- Extract text from PSD files using
Alternative: Contact Adobe Support
If API integration is absolutely necessary for your workflow (e.g., for server-side processing without a Photoshop installation), we recommend:
-
Contact Adobe Developer Support:
- Share your specific use case and examples
- Request clarification on the correct way to update text layers via API
- Ask for sample code that demonstrates the correct approach
- Inquire if there's a bug in the current implementation
-
Consider Adobe API Alternatives:
- Explore Adobe Creative Cloud Libraries API if applicable
- Check if there are newer Adobe API endpoints not yet documented
- Look into Adobe's partner programs for specialized solutions
-
Continue Investigating Approaches:
- Try other Adobe Photoshop API endpoints (e.g., actionJSON)
- Test with different PSD file structures
- Experiment with different layer organization
The Current API Limitation
The issue appears to be one of several possibilities:
- Undocumented API Limitation: The text update functionality may not be fully implemented
- Missing Information: There may be additional fields or headers required
- API Bug: The endpoint might have an issue that Adobe needs to fix
- Authentication Scope: We might need different permissions
Documentation of Our Testing
We've implemented thorough testing with these approaches:
-
Layer ID Approaches Tested:
- Direct IDs from JSON (1, 2, etc.)
- Estimated internal IDs (21, 22, etc.)
- Large random IDs (1001, 1002, etc.)
- All converted to integers as required
-
Layer Identification Methods Tested:
- Using "id" field (integer)
- Using "name" field (string)
- Using "path" field (string)
- Combinations of multiple identifiers
- Including original text as reference
-
API Response Pattern:
- Consistent 202 Accepted response
- Valid status URL returned
- Status shows "succeeded"
- Output file generated
- But no text changes applied
Conclusion: Use Local Scripting for Now
Until Adobe provides more information or fixes the API issues, we recommend using the local ExtendScript solution through our Python wrappers, which is proven to work correctly.
This approach guarantees text updates will be applied correctly, maintaining all formatting and styling.