Search code examples
c#imagewindows-phone-8.1

Windows phone 8.1 get image from imageview to BitmapImage


I'm trying to take an image from -

<Image x:Name="ImagePreview" HorizontalAlignment="Left" Height="492" Margin="10,10,0,0" Stretch="UniformToFill" VerticalAlignment="Top" Width="380" />

ImagePreview is used to preview images with added filters like grayScale, black&white or cropped original images. The purpose of all of that is to save on phone edited image.


Solution

  • Many thanks for user @LovetoCode . To get image you need to cast it from imagePreview.

    WriteableBitmap newImg = ImagePreview.Source as WriteableBitmap;

    or for bitmap : BitmapImage newImg = ImagePreview.Source as BitmapImage;