Skip to content

Instantly share code, notes, and snippets.

View appshish's full-sized avatar

Vaidy appshish

View GitHub Profile
@appshish
appshish / ImageResize.swift
Last active April 9, 2017 18:47
Resize Image in iOS Swift
// 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)