简体   繁体   中英

How to get Image Uri

I captured an image in my Windows Phone app and copied it to an image from canvas by making stream. Now i want to get its Uri to merge it with another image. This is what i have done so far

XAML:

<Canvas x:Name="frontCanvas" Margin="373,0,0,0" Grid.RowSpan="2">            
    <Canvas.Background>
        <VideoBrush x:Name="frontBrush" >
            <VideoBrush.RelativeTransform>
                <CompositeTransform x:Name="viewCompositeTransform" 
                  ScaleX="-1" CenterX=".5" CenterY=".5"/>
            </VideoBrush.RelativeTransform>
        </VideoBrush>
    </Canvas.Background>
</Canvas>

<Image Visibility="Collapsed" x:Name="frontImage" Margin="373,0,0,0" Grid.RowSpan="2">
</Image>

C#

void frontCam_CaptureImageAvailable(
      object sender, Microsoft.Devices.ContentReadyEventArgs e)
{ 
    Dispatcher.BeginInvoke(() =>
    {
        BitmapImage bmp2 = new BitmapImage();
        bmp2.SetSource(e.ImageStream);
        frontImage.Source = bmp2;
        frontCanvas.Visibility = Visibility.Collapsed;
        frontImage.Visibility = Visibility.Visible;
        //img2Name = bmp2.UriSource.ToString();
     });
}

If you have the image displayed in an Image that was captured from the camera then it won't have a URI. You'll have to work with it as a stream (or similar).

For combining images look at the blitting functions in the WriteableBitmapEx library.
Alternatively, if you're just looking to add effects to your image try the Lumia Imaging SDK .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM