Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return a Buffer from an export instead of writing to file #185

Closed
jay7n opened this Issue Apr 27, 2018 · 4 comments

Comments

Projects
5 participants
@jay7n
Copy link

jay7n commented Apr 27, 2018

Hi guys,

Is there a way (such an API) to acquire the thumbnail view's data from the layer inspector, which is highlighted in the below picture with a red rectangle? I need this kind of data ( as a NSImage type) to do some image comparisons.

default

Thanks in advance !

@mathieudutour

This comment has been minimized.

Copy link
Contributor

mathieudutour commented Apr 27, 2018

the export API only write to a file. We discussed with @bomberstudios about a way to return an NSData if an option is specified but it's not possible with the API yet

@mathieudutour mathieudutour changed the title How can I get the image data of the thumbnail view from the layer inspector ? API ? return NSData from an export instead of writing to file Apr 27, 2018

@jay7n

This comment has been minimized.

Copy link
Author

jay7n commented Apr 27, 2018

Is this (returning NSData from the export) being developed ? would appreciate it if I could know how long I have to wait to use it ... honestly I got stuck here and can't step any further.

If it's impossible to expect it in a near future, do you have any kind suggestions for some alternative ways to do the job ?

Thanks for your time again ~

@robintindale

This comment has been minimized.

Copy link
Contributor

robintindale commented Apr 27, 2018

You can use the old API for now, being aware of the disadvantages

  var ancestry = MSImmutableLayerAncestry.ancestryWithMSLayer(layer);
  var exportRequest = MSExportRequest.exportRequestsFromLayerAncestry(ancestry).firstObject();
  exportRequest.format = 'png';
  var rend1 = MSExportManager.alloc().init().rendererForRequest(exportRequest);
  var rep1 = rend1.bitmapImageRep();
  var data = rep1.representationUsingType_properties_(NSPNGFileType, nil);
@jay7n

This comment has been minimized.

Copy link
Author

jay7n commented Apr 27, 2018

thank you @robintindale I'll give it a try

@mathieudutour mathieudutour changed the title return NSData from an export instead of writing to file return a Buffer from an export instead of writing to file Oct 9, 2018

@mathieudutour mathieudutour added this to todo in Mathieu's todo Nov 9, 2018

@acf acf added the waffle:backlog label Nov 19, 2018

@mathieudutour mathieudutour moved this from todo to review in Mathieu's todo Feb 1, 2019

Mathieu's todo automation moved this from review to done Feb 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.