![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 |
| | #2 (permalink) |
| 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 |
| | #3 (permalink) |
| 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 |
| |
| |
![]() |
| 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 |