Skip to content

Instantly share code, notes, and snippets.

@ccgus
Created September 19, 2018 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccgus/a475e2916f1e860b3b7dd2143862d5a5 to your computer and use it in GitHub Desktop.
Save ccgus/a475e2916f1e860b3b7dd2143862d5a5 to your computer and use it in GitHub Desktop.
Calling Core Image with FMJS
var url = NSURL.fileURLWithPath_('/Library/Desktop Pictures/Yosemite.jpg');
var img = CIImage.imageWithContentsOfURL_(url)
var f = CIFilter.filterWithName_('CIColorInvert');
f.setValue_forKey_(img, kCIInputImageKey);
var r = f.outputImage();
var tiff = r.TIFFRepresentation();
tiff.writeToFile_atomically_('/tmp/foo.tiff', true);
NSWorkspace.sharedWorkspace().openFile_('/tmp/foo.tif');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment