6

I like to convert an NSImage to a CIImage in swift 2.2 for a mac app. Does anybody have some example code?

FJC
  • 213
  • 2
  • 9

1 Answers1

14

Here's one way:

let image = NSImage(contentsOfFile: "...")!
let imageData = image.tiffRepresentation!

let ciImage = CIImage(data: imageData)
andrewchan2022
  • 4,953
  • 45
  • 48
Code Different
  • 90,614
  • 16
  • 144
  • 163