This code base is not being maintained.
Cross platform Xamarin plugin to resize images while maintaining aspect ratio on a mobile device. This can be particularly useful when passing an image to an API.
Install via NuGet: https://www.nuget.org/packages/Plugin.ImageResizer Install-Package Plugin.ImageResizer -Pre As with any Xamarin Plugins, be sure to install the package to your shared code and platform-specific implementations.
This can be used with a stream (if you're using the Media Plugin https://github.com/jamesmontemagno/MediaPlugin) or standard byte arrays.
// If you already have the byte[]
byte[] resizedImage = await CrossImageResizer.Current.ResizeImageWithAspectRatioAsync(originalImageBytes, 500, 1000);
// If you have a stream, such as:
// var file = await CrossMedia.Current.PickPhotoAsync(options);
// var originalImageStream = file.GetStream();
byte[] resizedImage = await CrossImageResizer.Current.ResizeImageWithAspectRatioAsync(originalImageStream, 500, 1000);