adobe-photoshop / generator-core

Core Node.js library for Adobe Photoshop CC's Generator extensibility layer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

swapnadnk opened this issue · comments

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">
<path fill-rule="evenodd" fill="rgb(0, 0, 0)” d="M8.270,13.80 L9.99,12.260 C9.210,12.157 9.330,12.4 9.372,11.910 C8.723,11.867 8.56,11.559 7.501,11.4 C6.185,9.688 6.194,7.817 7.501,6.501 L11.30,2.980 C12.337,1.664 14.209,1.656 15.525,2.972 C16.849,4.305 16.849,6.176 15.533,7.483 L13.952,9.47 C14.123,9.662 14.123,10.320 14.12,10.953 L16.567,8.381 C18.438,6.509 18.456,3.843 16.559,1.938 C14.662,0.41 11.996,0.58 10.124,1.929 L6.458,5.595 C4.587,7.466 4.570,10.132 6.467,12.29 C7.14,12.585 7.638,12.952 8.270,13.80 ZM1.443,17.62 C3.340,18.959 6.6,18.942 7.885,17.62 L11.543,13.405 C13.423,11.525 13.440,8.859 11.543,6.962 C10.987,6.407 10.364,6.48 9.740,5.911 L8.894,6.757 C8.791,6.860 8.680,6.996 8.637,7.90 C9.287,7.133 9.953,7.441 10.509,7.996 C11.825,9.312 11.816,11.183 10.500,12.499 L6.980,16.20 C5.672,17.336 3.792,17.344 2.485,16.28 C1.169,14.687 1.161,12.833 2.477,11.517 L4.57,9.944 C3.886,9.338 3.878,8.680 3.998,8.47 L1.443,10.611 C0.436,12.491 0.462,15.157 1.443,17.62 Z”/>

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

@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?

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

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

@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?

@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.