psd.js icon indicating copy to clipboard operation
psd.js copied to clipboard

Is it possible to convert psd tree data to a psd file?

Open oklai opened this issue 8 years ago • 5 comments

// psd.tree().export()
const treeData = {
  "children": [
    {
      "type": "layer",
      "visible": true,
      "opacity": 1,
      "blendingMode": "normal",
      "name": "test layer",
      "left": 61,
      "right": 307,
      "top": 99,
      "bottom": 216,
      "height": 117,
      "width": 246,
      "text": {
        "value": "hello world",
        "font": {
          "name": "STYuanti-SC-Bold",
          "sizes": [120],
          "colors": [
            [
              0,
              0,
              0,
              255
            ]
          ],
          "alignment": [
            "center"
          ]
        },
        "left": 0,
        "top": 0,
        "right": 0,
        "bottom": 0,
      }
    }
  ]
}
treeData[0].text.value = 'hello psd'

const PSD = require('psd')
PSD.createPsdFileSync(treeData, '/path/new.psd')

oklai avatar Sep 27 '17 11:09 oklai

Not at this time. There's a significant amount of work involved in generating PSD's, and the exported tree data doesn't contain any image data anyways.

-- Ryan LeFevre (@meltingice) Sr. Software Engineer HODINKEE


From: Ethan Lai [email protected] Sent: Wednesday, September 27, 2017 7:49:09 AM To: meltingice/psd.js Cc: Subscribed Subject: [meltingice/psd.js] Is it possible to convert psd tree data to a psd file? (#106)

// psd.tree().export() const treeData = { "children": [ { "type": "layer", "visible": true, "opacity": 1, "blendingMode": "normal", "name": "test layer", "left": 61, "right": 307, "top": 99, "bottom": 216, "height": 117, "width": 246, "text": { "value": "hello world", "font": { "name": "STYuanti-SC-Bold", "sizes": [120], "colors": [ [ 0, 0, 0, 255 ] ], "alignment": [ "center" ] }, "left": 0, "top": 0, "right": 0, "bottom": 0, } } ] } treeData[0].text.value = 'hello psd' const PSD = require('psd') PSD.toPsdFile(treeData)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/meltingice/psd.js/issues/106, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAHtueEjr7VU51SRW-WYf9ddfHzXIZlVks5smjY1gaJpZM4Plo7U.

meltingice avatar Sep 27 '17 13:09 meltingice

I need that too.. @oklai if you find anything that can export to psd, pls let me know!

rui-cruz avatar Oct 16 '17 01:10 rui-cruz

+1

Vic020 avatar Jun 15 '18 05:06 Vic020

+1

rrsyycm avatar Nov 07 '19 12:11 rrsyycm

@oklai can you please share how to generate the tree structure of the PSD? I'm looking to generate the PSD tree data structure from the PSD file.

Much thanks!

shreyas0906 avatar Oct 29 '20 08:10 shreyas0906