Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. function getImageData64(data) {
  2.         var imageData = data;
  3.         var mimeType = "image/png";
  4.         return NSString.stringWithFormat(
  5.           "data:%@;base64,%@",
  6.           mimeType,
  7.           imageData.base64EncodedStringWithOptions(0)
  8.         );
  9.       }
  10. function getNSImageData(nsImage) {
  11.         var data = nsImage
  12.         var cgRef = nsImage.CGImageForProposedRect_context_hints(null,nil,nil);
  13.         var newRep = NSBitmapImageRep.alloc().initWithCGImage(cgRef);
  14.         newRep.setSize(nsImage.size());   // if you want the same resolution
  15.         var pngData = newRep.representationUsingType_properties(NSPNGFileType,nil);
  16.         return getImageData64(pngData)
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top