How to improve reescaled photos on a gui?
How to improve reescaled photos on a gui?
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.
Re: How to improve reescaled photos on a gui?
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.
Re: How to improve reescaled photos on a gui?
SKAN made a function for this see: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=34785
Re: How to improve reescaled photos on a gui?
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.
Re: How to improve reescaled photos on a gui?
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.
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.
Re: How to improve reescaled photos on a gui?
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 . . . .
Who is online
Users browsing this forum: nacken012 and 213 guests