0

I'm trying to take images in an array and shrink them down to thumbnail size. I have in mind the way an image looks when you assign someone a picture in contacts and the little picture comes up next to their name in texts. The method I'm using now creates an extremely blurry image - is there anything I can change to make it look like the quality in contacts?

var newSize:CGSize = CGSize(width: 40, height: 40)
let rect = CGRectMake(0, 0, newSize.width, newSize.height)
UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0)
pic.drawInRect(rect)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let imageData = UIImageJPEGRepresentation(newImage, 1.0)

Thanks!

Alex
  • 299
  • 3
  • 16

0 Answers0