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

Error when importing PSD with a text layer from Photopea

Open velara3 opened this issue 2 years ago • 2 comments

I'm getting an error when parsing a PSD that has a text layer saved from Photopea.

Github is not letting me attach a PSD.

Steps to reproduce:

  1. Open https://www.photopea.com/
  2. Create a A4 document
  3. Add a text layer to it
  4. Save as PSD
  5. Parse using psd.tree().export();

The error:

[TypeError: Cannot set properties of undefined (setting 'undefined')
  at updateNode (/node_modules/parse-engine-data/lib/parseEngineData.js:196:35)
  at Object.parse (/node_modules/parse-engine-data/lib/parseEngineData.js:80:13)
  at typeMatch (/node_modules/parse-engine-data/lib/parseEngineData.js:48:22)
  at /node_modules/parse-engine-data/lib/parseEngineData.js:38:9
  at Array.map (<anonymous>:null:null)
  at textReg (/node_modules/parse-engine-data/lib/parseEngineData.js:37:13)
  at paresr (/node_modules/parse-engine-data/lib/parseEngineData.js:22:5)
  at TextElements.module.exports.TextElements.parse (/node_modules/psd/lib/psd/layer_info/typetool.coffee:37:19)
  at LazyExecute.module.exports.LazyExecute.load (/node_modules/psd/lib/psd/lazy_execute.coffee:83:23)
  at LazyExecute.get (/node_modules/psd/lib/psd/lazy_execute.coffee:66:12)
  at Layer.module.exports.Layer.export [as export] (/node_modules/psd/lib/psd/nodes/layer.coffee:13:29)
  at /node_modules/psd/lib/psd/nodes/root.coffee:33:37
  at Array.map (<anonymous>:null:null)
  at Root.module.exports.Root.export [as export] (/node_modules/psd/lib/psd/nodes/root.coffee:33:26)

If I remove the text layer in Photopea and resave to a new PSD, PSDjs parses and there is no error.

velara3 avatar Mar 04 '23 00:03 velara3

#122 you cant change text using this lib !

nikhilrizal avatar Mar 04 '23 06:03 nikhilrizal

Hi I'm not editing the text with this library.

If I remove the text layer in Photopea and resave to a new PSD. Then when PSDjs parses there is no error ...meaning that the library does not like the Text layer.

velara3 avatar Mar 04 '23 21:03 velara3