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.
1 Like
For my plugin IconBoard I used this script by Pomax 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']
2 Likes
Thank you simon.
I got the basic data:
_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.
1 Like
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.