Skip to content

Instantly share code, notes, and snippets.

@dannycabrera
Last active January 2, 2018 21:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannycabrera/6729174 to your computer and use it in GitHub Desktop.
Save dannycabrera/6729174 to your computer and use it in GitHub Desktop.
Xamarin.iOS Image Resize
CGContext context = UIGraphics.GetCurrentContext ();
context.InterpolationQuality = CGInterpolationQuality.None;
context.TranslateCTM (0, newSize.Height);
context.ScaleCTM (1f, -1f);
context.DrawImage (new RectangleF (0, 0, newSize.Width, newSize.Height), source.CGImage);
var scaledImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
return scaledImage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment