How to Reduce Size of Image in windows phone

前端 未结 4 1625
说谎
说谎 2021-01-23 09:55

I am trying to port my app in windows phone . i have to upload an image on server So it is in small Size For uploading i have done this thing in Widows Successfully but problem

4条回答
  •  醉酒成梦
    2021-01-23 10:00

    You can try this. It worked for me. It reduced my 9.70MB file into 270KB.

    WriteableBitmap cameraCapturedImage = PictureDecoder.DecodeJpeg(e.ChosenPhoto, 1024, 1024);
    
    using (IsolatedStorageFileStream myFileStream = myStore.CreateFile(fileName))
    {
      System.Windows.Media.Imaging.Extensions.SaveJpeg(cameraCapturedImage, myFileStream, cameraCapturedImage.PixelWidth, cameraCapturedImage.PixelHeight, 0, 85);
      myFileStream.Close();
    }
    

    N.B: fileName is the name of file to save size reduced image.

提交回复
热议问题