You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Photoshop API Action JSON适配图片至指定尺寸?

解决Photoshop API适配图片指定尺寸的问题

你使用的javaScriptOptionsClass并非实现图片尺寸适配的正确对象,Photoshop API的Action JSON需要通过fitImage操作来完成指定尺寸的图片适配。以下是正确的配置示例:

正确的Action JSON适配配置

{
  "_obj": "fitImage",
  "_target": [{"_ref": "document", "_enum": "ordinal", "_value": "targetEnum"}],
  "width": {"_unit": "pixelsUnit", "_value": 1080.0},
  "height": {"_unit": "pixelsUnit", "_value": 1440.0},
  "constrainProportions": false,
  "resampleMethod": {"_enum": "resampleMethod", "_value": "bicubicAutomatic"}
}

参数说明

  • _obj: "fitImage":明确指定执行图片尺寸适配操作
  • _target:定位到当前操作的目标文档
  • width/height:设置目标宽高,单位为像素
  • constrainProportions:设为false可强制适配指定宽高;若需保持原图比例,设为true即可
  • resampleMethod:设置重采样算法,bicubicAutomatic是Photoshop默认的自动优化算法,也可替换为bilinear、nearestNeighbor等其他算法

将上述配置放入Action JSON的_commands数组中,与其他操作一起提交至https://image.adobe.io/pie/psdService/actionJSON端点即可生效。

内容的提问来源于stack exchange,提问作者Rasmus Lian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 08:17:06