Share via

Image Shrink issue

Niken Wadkar 1 Reputation point
2021-07-01T12:00:52.113+00:00

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

Developer technologies | Universal Windows Platform (UWP)

1 answer

Sort by: Most helpful
  1. AryaDing-MSFT 2,916 Reputation points
    2021-07-02T06:21:38.067+00:00

    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.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.