 	}
 
 	public var uiImage: UIImage {
-		return UIImage(CGImage: CGImage)
+		return UIImage(CGImage: cgImage)
 	}
 }
 #endif

		}
		
		public var nsImage: NSImage {
			return NSImage(CGImage: CGImage, size: NSSize.zero)
		}
	}
#endif

	public func resize(width  width: Int, height: Int, interpolationQuality: CGInterpolationQuality) -> Image<Pixel> {
		return Image(width: width, height: height) { context in
			CGContextSetInterpolationQuality(context, interpolationQuality)
			CGContextDrawImage(context, CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(height)), self.cgImage)
		}
	}
}

extension Image where Pixel: RGBAType { // CoreGraphics
	public init(cgImage: CGImageRef) {
		let width = CGImageGetWidth(cgImage)
		let height = CGImageGetHeight(cgImage)
		
		self.init(width: width, height: height, setUp: { context in
			let rect = CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(height))
			CGContextDrawImage(context, rect, cgImage)
		})
	}
	
