Set image scaling mode in Windows 7

Get help with using AutoHotkey and its commands and hotkeys
Posts: 299
Joined: 05 Dec 2016, 01:51

Set image scaling mode in Windows 7

12 Oct 2018, 22:53

On my Windows 7 SP1 x64 system, when DPI scaling is enabled, Windows insists on using "nearest neighbour" scaling on all my images and icons. Needless to say it looks absolutely dreadful and I simply cannot believe Microsoft would have made such a bad decision. I am convinced I must have a bugged registry setting somewhere.


Code: Select all

Gui , New
Gui , Add , Text , x10 y10 w110, % "A_ScreenDPI: " . A_ScreenDPI
ImageWidth := Round(178 * 1.25)
ImageHeight := Round(41 * 1.25)
Gui , -DPIScale
Gui , Add , Picture , x50 y40 w%ImageWidth% h%ImageHeight% AltSubmit, %A_ScriptDir%\PayPalButton.png   ;
Gui , Show , w300

Things I have tried so far:

1. Setting -DPIScale just before adding the image
2. Setting AltSubmit option to make it use GDI+ instead of GDI
3. Adding the picture using LoadImage() with/without GDI+ and passing handle to Gui , Add , Picture
4. Setting "Use windows XP style scaling" checked/unchecked in windows control panel

Nothing works, Windows just steamrolls over everything with its nearest neighbour garbage!!!

Thankfully this doesn't happen in Windows 10, but quite a lot of people still use Windows 7 so it's still not really acceptable if this is how it is on all Windows 7 machines. I googled this extensively and couldn't find a single blog post or article that talks about what scaling mode Windows 7 uses for dpi upscaling of images and icons.

It appears GDI+ has a function that sets the scaling mode, however we don't seem to have any way of calling that function - or do we? Can anyone more knowledgeable confirm this?

Also if someone could confirm that they are also getting forced nearest neighbour scaling on everything in Win7, please reply. To test it just set your Windows DPI to something other than 100%/96dpi (eg. 125%) which will then prompt you to log out and back in, and then load the script at top. If the image is all jagged and aliased then it's using nearest neighbour (i.e duplicating pixels instead of interpolating between them).


Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Gedzas, Google [Bot], songdg, yagami19821223, zvit and 46 guests