在Universal Application和Web服务之间发送图像的最佳方式

时间:2015-05-11 19:26:29

标签: c# asp.net-web-api2 win-universal-app

嗨我正在制作一个应用程序,从汽车及其驱动程序拍照,这些图片发送到网络服务,我有处理这种情况的问题,现在我已经尝试发送编码64基本字符串,但这不起作用

EDIT 这是我用于拍摄照片并将其保存为字节数组的代码

 ImageEncodingProperties format = ImageEncodingProperties.CreateJpeg();

        //rotate and save the image
        using (var imageStream = new InMemoryRandomAccessStream())
        {
            //generate stream from MediaCapture
            await PhotoCapture.CapturePhotoToStreamAsync(format, imageStream);
            await PhotoCapture.StopPreviewAsync();

            //create decoder and encoder
            BitmapDecoder dec = await BitmapDecoder.CreateAsync(imageStream);
            BitmapEncoder enc = await BitmapEncoder.CreateForTranscodingAsync(imageStream, dec);

            //roate the image
            enc.BitmapTransform.Rotation = BitmapRotation.Clockwise90Degrees;

            //write changes to the image stream
            await enc.FlushAsync();
            PreviewImage = new WriteableBitmap(350, 500);
            PreviewImage.SetSource(imageStream);

        }
        CaptureElement.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
        using (var ms = PreviewImage.PixelBuffer.AsStream())
        {
            MemoryStream memoryStream = new MemoryStream();
            ms.CopyTo(memoryStream);
            DriverModel.Picture = memoryStream.ToArray();
        }

当我这样做时,阵列大小就像2800万,显然我犯了错误

0 个答案:

没有答案