How to improve reescaled photos on a gui?

Get help with using AutoHotkey and its commands and hotkeys
Elaphe666
Posts: 131
Joined: 28 Nov 2015, 11:39

How to improve reescaled photos on a gui?

02 Sep 2020, 09:29

I have made a program with Autohotkey which works with guis as a picture viewer. The problem I have is that when large photos are reescaled to fit the screen, the display is no perfect, but something like a bad aliased image, so it's far from being as perfect as when I use ACDSee. Is there any way to improve the way Autohotkey reescales and displays the images, no matter if it's slower, and that I could implement in my script? Thank you.
colt
Posts: 176
Joined: 04 Aug 2014, 23:12
Location: Portland Oregon

Re: How to improve reescaled photos on a gui?

02 Sep 2020, 09:34

This would really slow it down depending on the power of your computer, but you could resize the image with imagemagick to a temp file before displaying the temp file in gui.
Elaphe666
Posts: 131
Joined: 28 Nov 2015, 11:39

Re: How to improve reescaled photos on a gui?

02 Sep 2020, 11:39

Thank you. I'm trying it right now and it looks like there's no problem in implementing the code and working with the resample.dll which uses GDI+. I'll test it tonight.
Elaphe666
Posts: 131
Joined: 28 Nov 2015, 11:39

Re: How to improve reescaled photos on a gui?

02 Sep 2020, 15:10

Alright, my image viewer is working perfectly with this method for displaying images. The results now are much much better. :)

I have a question. My program also has some editing capabilities (using hotkeys and Imagemagick), such as controlling contrast, saturation, levels, tones, etc. After every change, I'm using guicontrol in order to refresh the resulting image on screen. However, this means that the refreshed image is displayed the old way, not with the dll. Do you know any way to do this, but using the dll?

My code is something like this:

hBM1 := LoadPicture( image111, "GDI+")
hBM2 := DllCall( "Resample\CreateResampledBitmap", "UInt",DllCall( "GetDC", "UInt", 0 )
, "UInt",hBM1, "UInt",wd, "UInt",hg, "UInt",LANCZOS3 )

Gui, 2: Add, picture,x0 y%ya% w%wg% h%hd% vimage1 -background, HBITMAP:%hBM2%

...

guicontrol,2:, image1, %image111%

I have tried with guicontrol,2:, image1, HBITMAP:%hBM2% but it doesn't work.


EDIT: Forget it. It's working. I forgot that I had to use the .dll again after the edition of the images.
Last edited by Elaphe666 on 03 Sep 2020, 02:33, edited 1 time in total.
gwarble
Posts: 461
Joined: 30 Sep 2013, 15:01

Re: How to improve reescaled photos on a gui?

02 Sep 2020, 16:57

I would recommend using the GDI+ library (gdip.ahk, or gdip_all.ahk) directly and avoiding the resample.dll altogether if all its doing is GDI+ anyway. Gdip_SetInterpolationMode(G, 7) will give pretty good results, but I would try the other interpolation modes 2,3,4,6 and compare
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .

Return to “Ask For Help”

Who is online

Users browsing this forum: AHK_user, alexooo, Bing [Bot], hasantr, mcl, mikeyww, waveform and 30 guests