Ps plugin abilities

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:

  1. create temp Document
  2. copy layer to this Document (and hide some auxiliary child layers.)
  3. scale layer if needed. Extra, scale strokes, radius and effects by batchPlay
  4. create temp local file
  5. save document to temp file
  6. read buffer from local file
  7. close temp document (can not reuse it, because document can not clear all layers easily)
  8. 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?