Hello @kerrishotts
Better APIs are planned for this year, but for now, the process is a bit awkward.
How is this going?
Our goal is to get the slice PNG/SVG/JPG buffer of the layer (if needed, @1x,@2x,etc. ), and upload to our service. like Zeplin Plugin.
Currently I can only do this:
- create temp Document
- copy layer to this Document (and hide some auxiliary child layers.)
- scale layer if needed. Extra, scale strokes, radius and effects by batchPlay
- create temp local file
- save document to temp file
- read buffer from local file
- close temp document (can not reuse it, because document can not clear all layers easily)
- repeat 1 to handle next layer
This leads to unsatisfactory performance.
We are eager for a simpler and better-performing way to finish this job.Just like const buffer = layer.getLayerBuffer({type:'png', scale: 2, ...otherOptions})
Or is there a better way I haven’t found?