In my iPhone app, I take a picture with the camera, then I want to resize it to 290*390 pixels. I was using this method to resize the image :
UIImage *newI
A more compact version for Swift 4 and iOS 10+:
extension UIImage { func resized(to size: CGSize) -> UIImage { return UIGraphicsImageRenderer(size: size).image { _ in draw(in: CGRect(origin: .zero, size: size)) } } }
Usage:
let resizedImage = image.resized(to: CGSize(width: 50, height: 50))