artem78 / AutoScreenshot

Automatic screenshot maker
GNU General Public License v3.0
121 stars 21 forks source link

Can't take correct screenshot on 4K monitor #6

Closed nuthx closed 3 years ago

nuthx commented 3 years ago

When I use 4K monitor, it can't take a screenshot of correct resolution. Only topleft 2560x1440 can be taken and cut. I tried to run with my old 1080P monitor and 2K monitor, works perfectly on both.

Screenshot:

17 38 55

Version: 1.5

artem78 commented 3 years ago

You use very large display. What is your screen resolution in pixels?

Could you please run this test build? I made it for another issue, but seems that it may have an impact also in your case.

nuthx commented 3 years ago

It's 3840x2160, standard 4K resolution. I have tried that build yesterday, but still not works.

artem78 commented 3 years ago

I need more information.

1) Show your config.ini file or screenshot with program settings. 2) Have you tried to change settings like image format/color depth?

artem78 commented 3 years ago

3) Run this test and paste output here - ScreenTest.zip.

nuthx commented 3 years ago

Thanks, I'll try this and give you config file next Monday. Only my work place has the 4K monitor.

nuthx commented 3 years ago
  1. config.ini: [main] OutputDir=D:\OneDrive\ͼƬ\Daily ImageFormat=JPG JPEGQuality=80 ColorDepth=24 Language=en Grayscale=0 StartMinimized=1 StartCaptureOnStartUp=1 StopWhenInactive=0 AutoRun=1 FileNameTemplate=%Y-%M-%D\%H.%N.%S

  2. All four formats don't work.

  3. GetSystemMetrics(SM_CXVIRTUALSCREEN) GetSystemMetrics(SM_CYVIRTUALSCREEN) = 2560 1440 Screen.Width Screen.Height = 2560 1440 GetClientRect = 0 0 591 332 GetSystemMetrics(SM_XVIRTUALSCREEN) GetSystemMetrics(SM_YVIRTUALSCREEN) = 0 0 DesktopRect = 0 0 2560 1440 WorkAreaRect = 0 0 2560 1400 PPI = 96 Bitmap.Width Bitmap.Height = 2560 1440

It looks the screen test tool shows the wrong result. For reference, display resolution is 3840x2160 and do 150% scale on system setting.

artem78 commented 3 years ago

150% scale on system setting

Quite possibly that it may be a reason, because 2560x1400 * 1,5 = 3840x2160. Could you please make screenshot of your display settings, please?

artem78 commented 3 years ago

Also I need to know your monitor actual DPI.

artem78 commented 3 years ago

Could you please take screenshot of AutoScreenshot main window? I want to check if UI components look good/correct on your diplay.

nuthx commented 3 years ago

Quite possibly that it may be a reason, because 2560x1400 * 1,5 = 3840x2160.

I think it's the reason. It could take a correct resolution screenshot as 1.0 scale.

Calculated PPI is 163.18. I didn't find a way to show actual DPI.

20201215104429

20201215104502

By the way, I guess you can scale you screen on setting and test this issue.

artem78 commented 3 years ago

Thanks for screenshots you provided.

I guess you can scale you screen on setting and test this issue.

I will try.

rainlizard commented 3 years ago

I downloaded this program today and have the same issue with scaling. Using Windows 8.1, at 150% windows display scaling.

at 1440p resolution: screenshots are only 1707x960 (clipped to top left of screen) at 1080p resolution: screenshots are only 1280x720 (clipped to top left of screen)

So the math checks out, it's a scaling bug. But it would be good if this is fixed, because to change windows scaling setting back and forth you have to sign out or restart windows which is very inconvenient.

artem78 commented 3 years ago

I downloaded this program today and have the same issue with scaling.

This problem happens when your scale is 150% or more. In this case Windows provides to the program incorrect sizes. bacause it imitates 96 DPI for program UI.

In theory I can make my program DPI Aware. But it will lead to remaking GUI for supporting different screen DPI. I think instead of this it will be better to migrate program to modern Delphi version where HighDPI is supported.

Unfortunately, at the moment I have no other ideas how to get correct values.

nuthx commented 3 years ago

Now I found a way to avoid this issue:

  1. Right click AutoScreenshot and goto property
  2. Goto compatibility, then click Change high DPI settings
  3. Check Override high DPI scaling behavior
  4. Enjoy
delfer commented 3 years ago

Confirming issue. My display is 1920x1280 with a 150% scale. But AutoScreenshot detects it as 1280x853 and screenshots are clipped. 2021-05-24 00 29 34

artem78 commented 3 years ago

@delfer This is known issue, but unfortunatelly at the moment I can`t fix it (migrate to newer version of Delphi needed for this), Anyway thank you.

xor2003 commented 3 years ago

What about to build with Lazarus?

artem78 commented 3 years ago

What about to build with Lazarus?

Yes, I didn't forget about Lazarus. It also has High DPI support and allow to fix this issue. But migration need much time.

However I started to port project to Lazarus for experiment. Looks good and it is possible that one of the next release will be made with Lazarus.

artem78 commented 3 years ago

Fixed in v1.8

Sumeng257 commented 2 years ago

Now I found a way to avoid this issue:

  1. Right click AutoScreenshot and goto property
  2. Goto compatibility, then click Change high DPI settings
  3. Check Override high DPI scaling behavior
  4. Enjoy

brilliant!I love you