# How to get a layer SVG

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-get-a-layer-svg/2769>\
**Category:** Photoshop\
**Tags:** javascript\
**Created:** [April 8, 2021, 1:25am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-a-layer-svg/2769 "2021-04-08T01:25:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forums.creativeclouddeveloper.com/u/luke)\
**Post date:** [April 8, 2021, 1:25am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-a-layer-svg/2769/1 "2021-04-08T01:25:33Z")

</div>

Is there a way to get a layer svg data.  
buffer or string better.  
I want to get the svg to upload to my personal website. 😁

---

<div class="post-metadata">

**Author:** ![simonhenke](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/simonhenke/32/957_2.png) [@simonhenke](https://forums.creativeclouddeveloper.com/u/simonhenke)\
**Post date:** [April 8, 2021, 12:05pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-a-layer-svg/2769/2 "2021-04-08T12:05:19Z")

</div>

For my plugin IconBoard I used [this script by Pomax](https://github.com/Pomax/photoshop-paths-to-SVG) as a starting point, which took quite a while to port to UXP… I should had done more research, as there’s simply a property called `layerSVGdata` that you can read from a shape layer in Photoshop CC+.

```
photoshop.action.batchPlay([
    {
      _obj: 'get',
      _target: [
        { _property: 'layerSVGdata' },
        { _ref: 'layer', _enum: 'ordinal', _value: 'targetEnum' }],
    },
  ], {})[0]['layerSVGdata']
```

---

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forums.creativeclouddeveloper.com/u/luke)\
**Post date:** [April 9, 2021, 1:03am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-a-layer-svg/2769/3 "2021-04-09T01:03:40Z")

</div>

Thank you simon.

I got the basic data:

```auto
_obj: 'get',
    _target: [
      {
        _property: 'layerSVGdata',
      },
      {
        _ref: 'layer',
        _id: layerID,
        _enum: 'ordinal',
        _value: 'targetEnum',
      },
    ],
    _options: {
      dialogOptions: 'dontDisplay',
    },

```

But there is something wrong.  
some properties lost, such as fill, layerEffects and so on. 😥

---

<div class="post-metadata">

**Author:** ![simonhenke](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/simonhenke/32/957_2.png) [@simonhenke](https://forums.creativeclouddeveloper.com/u/simonhenke)\
**Post date:** [April 9, 2021, 11:24am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-a-layer-svg/2769/4 "2021-04-09T11:24:46Z")

</div>

I haven’t yet played around much with that property, but when I tested it yesterday on a red ellipsis, the SVG also had the respective fill color (if i remember correctly).

LayerEffects however are something Photoshop-specific and not part of the SVG standard. After all, they’re also pixel- and not vector-based.
