adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer
MIT License
692 stars 97 forks source link

getLayerAttr("layerVectorPointData") returns incorrect data in Photoshop 2021 and 2022 #427

Open swapnadnk opened 2 years ago

swapnadnk commented 2 years ago

We are using generator-core to create SVG files. getLayerAttr("layerVectorPointData") of generator-core returns incorrect data in Photoshop 2021 and 2022. The immediate zeros following the decimal point and the negative signs are getting stripped. This is resulting in the deformed SVGs. Following is the data from Photoshop 2022 and Photoshop 2020 to compare the values.

2022:

xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18px" height="19px">

2020:

xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18px" height="19px">
mcilroyc commented 2 years ago

@swapnadnk it looks like the path data got truncated in your bug description. Would it be possible for you to post a PSD file and code snippet that can reproduce this issue?

swapnadnk commented 2 years ago

@mcilroyc here is the test.psb and code snippet Archive.zip

RyBOT777 commented 2 years ago

Cory would you like us to submit a bug report for this for tracking purposes or has one already been made?

mcilroyc commented 2 years ago

@swapnadnk I tried exporting an SVG using the standard "image assets" generator plugin and it seemed to work fine. I added an .svg suffix to the layer name in your PSB, and then turned on File > Generate > Image Assets. The output file looked right to me when I opened it in Photoshop. Can you confirm that works as you would expect, and does that help clarify the issue you're seeing in your own code?

swapnadnk commented 2 years ago

@mcilroyc, thank you. I added .svg to the layer as you said and turned on File > Generate > Image Assets. This works in the manual process. I will try to automate it.