I am creating an application in which many screenshots are taken, converted to NSData, and saved. With the current code I have, everything works with no errors, but running
bitmap.representationUsingType(NSBitmapImageFileType.NSJPEGFileType, properties: [NSImageCompressionFactor:0.1])
takes a very long time.
Here is the code:
let ref=CGWindowListCreateImage(CGRect.infinite, CGWindowListOption.OptionAll, 0, CGWindowImageOption.Default)
let bitmap=NSBitmapImageRep(CGImage: CGBitmapContextCreateImage(context)!)
let data=bitmap.representationUsingType(NSBitmapImageFileType.NSJPEGFileType, properties: [NSImageCompressionFactor:0.1])
Is there a more efficient or faster way of accomplishing this?