Coe
Coe

Reputation: 21

Trying to resize an image to a thumbnail, getting error "Use of unresolved identifier" for kCGInterpolationHigh

Trying to resize an image to a thumbnail using the following code, getting error:

Use of unresolved identifier

for kCGInterpolationHigh

@IBAction func dropPhoto(sender: AnyObject) {
    presentViewController(imagePicker, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
    self.dismissViewControllerAnimated(true, completion: nil)

    let thumbnail = image.resizedImageWithContentMode(UIViewContentMode.ScaleAspectFit, bounds: CGSizeMake(400, 400), interpolationQuality: kCGInterpolationHigh)
    let imgData = UIImagePNGRepresentation(thumbnail)

}
}

Upvotes: 2

Views: 990

Answers (1)

Eric Aya
Eric Aya

Reputation: 70098

Use CGInterpolationQuality.High instead of kCGInterpolationHigh in iOS 9+.

Reference: https://developer.apple.com/library/prerelease/ios/documentation/GraphicsImaging/Reference/CGContext/index.html#//apple_ref/c/tdef/CGInterpolationQuality

Upvotes: 3

Related Questions