question

JassimAlRahma-9056 avatar image
0 Votes"
JassimAlRahma-9056 asked WenyanZhang-MSFT edited

How ot fill the photo?


Hi,

I am trying CameraView from the Xamarin Community Toolkit for the first time but when I take a photo I want to be the same as what is shown in the CameraView.

In below image you can see that the image is different and it's like a Tall image instead of a Box

Kindly help...





137044-img-7528.jpg


dotnet-xamarin
img-7528.jpg (324.0 KiB)
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do you need full screen in the second image you provided? You could try to check the layout of the CameraView and the Zoom property.
137401-image.png



0 Votes 0 ·
image.png (489.5 KiB)

I did but did not work.

Here is my XAML:

 <Grid Margin="20">
     <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
     </Grid.RowDefinitions>
    
     <SyncfusionBorder:SfBorder Grid.Row="0" HeightRequest="{OnIdiom Phone=250, Tablet=500}" WidthRequest="100" BorderWidth="1" CornerRadius="20">
         <xct:CameraView
             x:Name="cameraView"
             CaptureMode="Photo"
             FlashMode="On"
             WidthRequest="100" 
             HeightRequest="{OnIdiom Phone=250, Tablet=500}"
             MediaCaptured="cameraView_MediaCaptured"
             OnAvailable="CameraView_OnAvailable" />
     </SyncfusionBorder:SfBorder>
    
     <Button x:Name="doCameraThings" Grid.Row="2" Clicked="DoCameraThings_Clicked" BackgroundColor="Navy" TextColor="White" Padding="20" Text="Snap picture" />
    
     <Image Grid.Row="3" x:Name="previewPicture" Aspect="AspectFit" BackgroundColor="LightGray" WidthRequest="100" HeightRequest="{OnIdiom Phone=250, Tablet=500}" />
    
 </Grid>


0 Votes 0 ·

Cameraview seems to be just a viewfinder frame, the obtained image is a bit bigger, I try to disply the image in a new page and save it to my phone, the image is not same to Cameraview. I will test this simple, you could also have a try to check there is the same issue in this demo.

  private void cameraView_MediaCaptured(object sender, Xamarin.CommunityToolkit.UI.Views.MediaCapturedEventArgs e)
         {
             Navigation.PushAsync(new ShowImagPage(e.Image));
         }


0 Votes 0 ·
Show more comments

0 Answers