Created
August 22, 2017 22:52
-
-
Save magicien/b778413bda8931569120a18e7ff50e51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let url = URL(fileURLWithPath: pngFileName, relativeTo: directoryPath) | |
// let reddishImage = NSImage(contentsOf: url) | |
let cgDataProvider = CGDataProvider(url: url as CFURL)! | |
let cgImage = CGImage(pngDataProviderSource: cgDataProvider, decode: nil, shouldInterpolate: false, intent: CGColorRenderingIntent.defaultIntent)! | |
let imageSize = CGSize(width: cgImage.width, height: cgImage.height) | |
let correctImage = NSImage(cgImage: cgImage, size: imageSize) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment