How to avoid a blurred image? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

How to avoid a blurred image?

21 Feb 2023, 11:18

Dear experts,
In my script I have these statements

Code: Select all

  aNewButtons[jNew].imgbase := BtnimgBase
  If (bETBalso) {
    aNewButtons[jNew].imgbase := BtnimgBase . "_2X.png"     ; do not allow to scale
  }
  aNewButtons[jNew].icon    := iconCurBtn
  Gui Add, Picture, x%newBtnX% y300 w36 h36 , %iconCurBtn%
The images are 36x36 pixels in size. When presented in the GUI they appear blurred (the right image in the screen shot). The left image shows the same images as imported into FrameMaker at 100% display of the document. They are much sharper.
Image
The following are the original images (which appear in the browser as crisp as on my screen in FrameMaker):
Image Image Image
What is wrong with my code?
Klaus Daube, Zürich, CH
User avatar
Hellbent
Posts: 2114
Joined: 23 Sep 2017, 13:34

Re: How to avoid a blurred image?

21 Feb 2023, 11:43

Could be a scaling issue. What is your screen DPI?
20230221114450.png
20230221114450.png (40.62 KiB) Viewed 358 times

Code: Select all

#SingleInstance, Force

path := "ImagePath"
Gui, -DPIScale
Gui, Add, Picture, hwndPic1Hwnd, % path
GuiControlGet, pos , pos , % Pic1Hwnd 
Gui, Add, Picture, % "w" posW * 3 " h" posH * 3 "hwndPic2Hwnd", % path ; <<<--- Scaled image
Gui, Show, 

return
GuiClose:
*ESC::ExitApp

*Edit.
if that's not the cause you can try removing the width and height options from the picture control to ensure that you are right about it being 36*36.
Last edited by Hellbent on 21 Feb 2023, 11:49, edited 1 time in total.
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Re: How to avoid a blurred image?

21 Feb 2023, 11:47

Thank You Hellbent for your answer,
I'm further investigating my code, because the following snipped displays crisp images:

Code: Select all

; GUI-Picture.ahk
  iconCurBtn := "E:\\_DDDprojects\\ETB-14up\\Sources\\etb_icons\\import_formats_2X.png"
  Gui Add, Picture, x050 y010 w36 h36 , %iconCurBtn%
  Gui Add, Picture, x050 y050         , %iconCurBtn%
  Gui Add, Picture, x050 y090 w36 h36 , %iconCurBtn%
  Gui Show
Klaus Daube, Zürich, CH
User avatar
kdaube
Posts: 86
Joined: 02 Nov 2015, 03:11

Re: How to avoid a blurred image?  Topic is solved

21 Feb 2023, 12:40

I have now found the reason for the blurred images.
Since there are two sources for the images;
The first contains the icons in the desired size (36x36)
The second contains 6 versions per image (coloured/bW each 18x18, 27x27 and 36x36) the current icon was not selected correctly. these were the ones blurred. After correcting the file name to get the desired size (36x36) things are OK now.

Thank You for discussing with me!
Klaus Daube, Zürich, CH

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Hugh Jars, Mateusz53, peter_ahk, Pianist and 356 guests