private async Task<IRandomAccessStream> ResizeJpegStreamAsyncRubbish(int maxPixelDimension, int percentQuality, IRandomAccessStream input)
{
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(input);
// create a new stream and encoder for the new image
var ras = new InMemoryRandomAccessStream();
var enc = await BitmapEncoder.CreateForTranscodingAsync(ras, decoder);
int targetHeight;
int targetWidth;
MvxPictureDimensionHelper.TargetWidthAndHeight(maxPixelDimension, (int)decoder.PixelWidth, (int)decoder.PixelHeight, out targetWidth, out targetHeight);
enc.BitmapTransform.ScaledHeight = (uint)targetHeight;
enc.BitmapTransform.ScaledWidth = (uint)targetWidth;
// write out to the stream
await enc.FlushAsync();
return ras;
}