question

NikenWadkar-4613 avatar image
0 Votes"
NikenWadkar-4613 asked AryaDing-MSFT commented

Image Shrink issue

I have generated a image from large content xaml layout. But image is shrink. We have used "RenderTargetBitmap.RenderAsync()" method for image generate. How to get actual size image from xaml layout? please check below attached image.
110900-bitmapimagepng2.png


windows-uwp
bitmapimagepng2.png (173.9 KiB)
· 1
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.

@NikenWadkar-4613 How about the progress? If your question hasn't been solved, please feel free to contact us.

0 Votes 0 ·

1 Answer

AryaDing-MSFT avatar image
0 Votes"
AryaDing-MSFT answered

Hi,

Welcome to Microsoft Q&A!

You could use RenderAsync(UIElement, Int32, Int32) method to specify values for scaledWidth and scaledHeight to alter the original source's rendering dimension. As for actual size of container, you could use FrameworkElement.ActualWidth and FrameworkElement.ActualHeight property to get (such as mygrid.ActualWidth).

What you need to know is if scaledWidth and scaledHeight are both set, the aspect ratio of the original bitmap is ignored, and your values can alter the aspect ratio. More info could be found in this part about scaledWidth and scaledHeight values of this official document.



If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

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.