以编程方式编辑PSD智能对象

时间:2018-10-04 13:57:15

标签: javascript photoshop psd

有一个PSDfile,可以用一个基本图像(https://www.dropbox.com/s/8nlpnwx4771uwoe/Lanyard_Mockup_1.psd?dl=0)挂绳。我想使用psd.js工具编辑基本图像。如果我们在photoshop中打开PSD文档并编辑智能对象,则整个挂绳设计都会改变。谁能帮助我解决问题

导出psd对象后,我得到了以下JSON。

 {
    "children": [
    {
      "type": "layer",
      "visible": true,
      "opacity": 0,
      "blendingMode": "normal",
      "name": "Lanyard project",
      "left": -1054,
      "right": 0,
      "top": -153,
      "bottom": 45,
      "height": 198,
      "width": 1054,
      "mask": {},
      "image": {}
    },
    {
      "type": "group",
      "visible": true,
      "opacity": 1,
      "blendingMode": "normal",
      "name": "Mockup",
      "left": -441,
      "right": 2637,
      "top": 0,
      "bottom": 1000,
      "height": 1000,
      "width": 3078,
      "children": [
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "normal",
          "name": "Highlights",
          "left": 0,
          "right": 2500,
          "top": 0,
          "bottom": 1000,
          "height": 1000,
          "width": 2500,
          "mask": {
            "top": 396,
            "left": 270,
            "bottom": 664,
            "right": 2448,
            "width": 2178,
            "height": 268,
            "defaultColor": 0,
            "relative": false,
            "disabled": false,
            "invert": false
          },
          "image": {}
        },
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "linear_burn",
          "name": "LANYARD MOCKUP copy 5",
          "left": 1412,
          "right": 2395,
          "top": 382,
          "bottom": 571,
          "height": 189,
          "width": 983,
          "mask": {
            "top": 454,
            "left": 1324,
            "bottom": 726,
            "right": 2393,
            "width": 1069,
            "height": 272,
            "defaultColor": 255,
            "relative": false,
            "disabled": false,
            "invert": false
          },
          "image": {}
        },
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "linear_burn",
          "name": "LANYARD MOCKUP copy 9",
          "left": -441,
          "right": 382,
          "top": 461,
          "bottom": 648,
          "height": 187,
          "width": 823,
          "mask": {
            "top": 455,
            "left": 269,
            "bottom": 625,
            "right": 389,
            "width": 120,
            "height": 170,
            "defaultColor": 0,
            "relative": false,
            "disabled": false,
            "invert": false
          },
          "image": {}
        },
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "linear_burn",
          "name": "LANYARD MOCKUP copy 4",
          "left": 364,
          "right": 1418,
          "top": 417,
          "bottom": 612,
          "height": 195,
          "width": 1054,
          "mask": {},
          "image": {}
        },
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "linear_burn",
          "name": "LANYARD MOCKUP copy 8",
          "left": 2035,
          "right": 2448,
          "top": 186,
          "bottom": 852,
          "height": 666,
          "width": 413,
          "mask": {
            "top": 451,
            "left": 2307,
            "bottom": 599,
            "right": 2465,
            "width": 158,
            "height": 148,
            "defaultColor": 0,
            "relative": false,
            "disabled": false,
            "invert": false
          },
          "image": {}
        },
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "linear_burn",
          "name": "LANYARD MOCKUP copy 7",
          "left": 1633,
          "right": 2637,
          "top": 519,
          "bottom": 666,
          "height": 147,
          "width": 1004,
          "mask": {
            "top": 511,
            "left": 1630,
            "bottom": 725,
            "right": 2500,
            "width": 870,
            "height": 214,
            "defaultColor": 0,
            "relative": false,
            "disabled": false,
            "invert": false
          },
          "image": {}
        },
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "linear_burn",
          "name": "LANYARD MOCKUP copy 6",
          "left": 487,
          "right": 1645,
          "top": 464,
          "bottom": 650,
          "height": 186,
          "width": 1158,
          "mask": {
            "top": 461,
            "left": 484,
            "bottom": 653,
            "right": 1646,
            "width": 1162,
            "height": 192,
            "defaultColor": 0,
            "relative": false,
            "disabled": false,
            "invert": false
          },
          "image": {}
        },
        {
          "type": "layer",
          "visible": true,
          "opacity": 1,
          "blendingMode": "normal",
          "name": "Levels 1",
          "left": 56,
          "right": 2449,
          "top": 395,
          "bottom": 666,
          "height": 271,
          "width": 2393,
          "mask": {},
          "image": {}
        }
      ]
    },
    {
      "type": "layer",
      "visible": true,
      "opacity": 1,
      "blendingMode": "linear_burn",
      "name": "Shadow",
      "left": 0,
      "right": 2500,
      "top": 0,
      "bottom": 1000,
      "height": 1000,
      "width": 2500,
      "mask": {
        "top": 0,
        "left": 0,
        "bottom": 1000,
        "right": 2500,
        "width": 2500,
        "height": 1000,
        "defaultColor": 255,
        "relative": false,
        "disabled": false,
        "invert": false
      },
      "image": {}
    },
    {
      "type": "layer",
      "visible": true,
      "opacity": 1,
      "blendingMode": "normal",
      "name": "Background color",
      "left": 0,
      "right": 2500,
      "top": 0,
      "bottom": 1000,
      "height": 1000,
      "width": 2500,
      "mask": {
        "top": 0,
        "left": 0,
        "bottom": 0,
        "right": 0,
        "width": 0,
        "height": 0,
        "defaultColor": 255,
        "relative": false,
        "disabled": false,
        "invert": false
      },
      "image": {}
    }
    ],
    "document": {
    "width": 2500,
    "height": 1000,
    "resources": {
      "layerComps": [],
      "guides": [],
      "slices": []
    }
   }

1 个答案:

答案 0 :(得分:0)

PSD.js仅用于读取文件。我们可以使用PSD.jS编辑PSD。希望此评论对其他人有帮助