Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Image scaling

 
 
Old 11-02-2006   #1 (permalink)
Jaska


 
 

Image scaling

I have a PNG image that has DPI set to 71 but my screen has DPI set to 96.
This is why WPF scales the images about 30% bigger (92/71 = 1,3)
This happens even if I set Stretch to None

<Page>
<Image Stretch="None" Source="Sample.png"/>
</Page>

I want WPF to render image exactly on the width of image in pixels. How to
do that?

- Jaska



My System SpecsSystem Spec
Old 11-06-2006   #2 (permalink)
Laurent Bugnion


 
 

Re: Image scaling

Hi,

Jaska wrote:
> I have a PNG image that has DPI set to 71 but my screen has DPI set to 96.
> This is why WPF scales the images about 30% bigger (92/71 = 1,3)
> This happens even if I set Stretch to None
>
> <Page>
> <Image Stretch="None" Source="Sample.png"/>
> </Page>
>
> I want WPF to render image exactly on the width of image in pixels. How to
> do that?
>
> - Jaska


You can force the width and height of the image by using the Width and
Height properties. Note however that WPF doesn't use pixels as units,
but "Device independent units". So if you set to a (theoretical) width
of 10, it means 10/96 inches, not 10 pixels. This is designed to allow
you to have your application look exactly the same whatever the user's
screen resolution is set to.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
DPI Scaling Tutorials
Scaling Vista installation & setup
window scaling Vista General
DPI Scaling does not work Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46