This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Courtesy: Hampton Catlin's gist. | |
// to resize an image to dimension 52x52 | |
var newSize:CGSize = CGSize(width: 52,height: 52) | |
let rect = CGRectMake(0,0, newSize.width, newSize.height) | |
UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0) | |
// image is a variable of type UIImage | |
image?.drawInRect(rect) |