All things iOS & Swift

Resizing UIImage with Swift

Screenshot 2015-02-20 08.46.00

Trying to resize the image taken from photo library or camera

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {

var imagePhoto: UIImage = info[UIImagePickerControllerOriginalImage] as UIImage!
dismissViewControllerAnimated(true, completion: nil)

var imageManipulation = ImageManipulation()
let newImage = imageManipulation.imageResizeTo(imagePhoto, size: CGSizeMake(170, 250))

profileImageView.backgroundColor = UIColor(patternImage: newImage!)


the code inside ImageManipulation() function

example project for swift 2.0

5 Discussions on
“Resizing UIImage with Swift”

Leave A Comment

Your email address will not be published.