Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Image scaling

Closed Thread
 
Thread Tools Display Modes
Old 11-02-2006   #1 (permalink)
Jaska
Guest


 

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


Old 11-06-2006   #2 (permalink)
Laurent Bugnion
Guest


 

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
Old 11-06-2006   #3 (permalink)
Laurent Bugnion
Guest


 

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
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
DPI Scaling Brink Tutorials 4 06-28-2008 08:23 AM
Scaling Kenwood Vista installation & setup 2 06-09-2008 08:22 AM
window scaling Candace Vista General 1 06-03-2008 09:41 AM
DPI Scaling does not work Dukiedog Vista installation & setup 3 09-25-2007 03:55 PM
Scaling CesarTabares Avalon 2 06-05-2006 03:46 AM








Vistax64.com 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 2005-2008

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 47 48 49 50