Hi, I am having problems getting a PNG representation of an NSImage object.
That's what I'm doing:
var imgData: NSData! = coverImgView.image!.TIFFRepresentation! var bitmap: NSBitmapImageRep! = NSBitmapImageRep(data: imgData!) var pngCoverImage = bitmap!.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: nil)
coverImgView - NSImageView object
However, I canβt even compile it.
It says: Type '[NSObject: AnyObject]' does not comply with the protocol 'NilLiteralConvertible' (third line of the above code, argument "properties: nil")
I am trying to do something similar to the PNGRepresentationOfImage function here https://gist.github.com/mtabini/1178403
Any ideas?
Thanks a lot ~
source share