Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low image quality on exports #353

Closed
espindola opened this issue Feb 25, 2023 · 22 comments
Closed

Low image quality on exports #353

espindola opened this issue Feb 25, 2023 · 22 comments
Labels
HiDPI Display issues in HiDPI mode

Comments

@espindola
Copy link

I am using f4d31c4

The attached screenshots of demo mode illustrate the problems. The first one is that the resolution is low. It seems to have something to do with HiDPI displays. I was able to hack it locally by multiplying the width and heighth by 2, but I am not sure what the proper fix is.

The other problem is that some lines are broken.

Everything looks good when running OpenHantek, it is only the exported pngs that are bad.

20230225_214026
20230225_211451

Computer environment (please complete the following information):

I am running alpine linux 3.17, but I have been able to reproduce this with a debian stable chroot. Somehow the issue is not present on arch linux with version 3.3.2.1-1.

Given that it fails with a debian stable chroot, I suspect that somehow the sway or kernel version is relevant:

linux-lts-5.15.95-r0
sway-1.7-r4

  • Video hardware: [e.g. Intel Xeon ... Integrated Graphics]

Intel Corporation HD Graphics 620 (rev 02)

  • OpenGL version: [e.g. OpenGL 4.5, Mesa 19.0.3]

Graphic: 4.6 (Compatibility Profile) Mesa 22.2.5 - GLSL version 1.20

  • Qt version: [e.g. Qt 5.11.x]

qt5-qtbase-5.15.6_git20221010-r0

  • C++ compiler version: [e.g. gcc 8.3.x]

gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924

Scope device (please complete the following information):

demo mode

@espindola
Copy link
Author

espindola commented Feb 26, 2023

I expanded the experiment by installing fedora 37 in a VM and producing screenshots from the vm and then mounting the qcow2 image, chrooting into it and producing new screenshots. As far as I know, the only thing from alpine 3.17 being used in the chroot case is the wayland compositor (sway) and the kernel.

The 4 images are attached.

fedora-in-vm-screenshot:
fedora-in-vm-screenshot

fedora-in-vm-hardcopy:
fedora-in-vm-hardcopy

fedora-in-chroot-screenshot:
fedora-in-chroot-screen

fedora-in-chroot-hardcopy:
fedora-in-chroot-hardcopy

@iss000
Copy link

iss000 commented Feb 26, 2023

Just for reference - Fedora 36 (64 bit), KDE, Wayland. Attached are demo mode screenshot, hardcopy and the whole window captured with spectacle.
20230226_140311
20230226_140328
Screenshot_20230226_140340

@Ho-Ro
Copy link
Member

Ho-Ro commented Feb 26, 2023

I was able to hack it locally by multiplying the width and heighth by 2, but I am not sure what the proper fix is.

@espindola
Which screen resolution do you use?
Where did you multiply by 2?
Please give me a chance to understand the issue - I do not see this behaviour on my laptops (1280x800 and 1920x1080).

@Ho-Ro Ho-Ro added the Graphic Graphic / OpenGL related issues, artifacts or blank screen label Feb 26, 2023
@Vascom
Copy link
Contributor

Vascom commented Feb 27, 2023

I also have HiDPI monitor 3840x2112 and the same problem.
I think we need option to set waveform line width.

@Ho-Ro
Copy link
Member

Ho-Ro commented Feb 27, 2023

set waveform line width

I already tried this long ago. Unfortunately this is not possible with the OpenGL graphics. The option for line width doesn't work - the width stays always "1".
The OpenGL implementation is more than 10 years old when hi dpi was not common. :(

@espindola
Copy link
Author

I was able to hack it locally by multiplying the width and heighth by 2, but I am not sure what the proper fix is.

@espindola Which screen resolution do you use? Where did you multiply by 2? Please give me a chance to understand the issue - I do not see this behaviour on my laptops (1280x800 and 1920x1080).

My laptop resolution is 3200x1800, but sway is configured to scale it by 2 (" scale 2" in the config file). I did the hack of multiplying by 2 by adding

     int sw = screenshot.width();
     int sh = screenshot.height();
+
+    screenshot = screenshot.scaled( sw *= 2, sh *= 2 );
+

I should probably try a KDE or Gnome session to compare. Will hopefully have that tonight.

@espindola
Copy link
Author

Thinks look OK on my desktop, which has a 4K display (but is running arch, which has a newer version of sway).

@espindola
Copy link
Author

I also have HiDPI monitor 3840x2112 and the same problem. I think we need option to set waveform line width.

Are you using Wayland or X? Which compositor?

@Vascom
Copy link
Contributor

Vascom commented Feb 27, 2023

I also have HiDPI monitor 3840x2112 and the same problem. I think we need option to set waveform line width.

Are you using Wayland or X? Which compositor?

Currently X11, Kwin.

@espindola
Copy link
Author

I got the same issue with gnome instead of sway. Note that the take a regular screenshot (not via the OpenHantek menu) works just fine. One captured with grim is attached.

Looks like QT knows to do something different when outputting directly to the screen instead of to a QPixmap.

20230227_17h41m03s_grim

@espindola
Copy link
Author

One possible workaround is to disable the hdpi scaling just to produce the screenshot/hardcopy. This is what I got when I did that:

20230227_175739

@Ho-Ro
Copy link
Member

Ho-Ro commented Mar 2, 2023

@espindola What are your values of sw and sh before you scale them? About 3200x1800 or 1600x900 (scale2)?

     int sw = screenshot.width();
     int sh = screenshot.height();
+    qDebug() << "screenshot size:" << sw << "x" << sh;

     screenshot = screenshot.scaled( sw *= 2, sh *= 2 );

@Ho-Ro Ho-Ro added HiDPI Display issues in HiDPI mode and removed Graphic Graphic / OpenGL related issues, artifacts or blank screen labels Mar 2, 2023
@espindola
Copy link
Author

@espindola What are your values of sw and sh before you scale them? About 3200x1800 or 1600x900 (scale2)?

     int sw = screenshot.width();
     int sh = screenshot.height();
+    qDebug() << "screenshot size:" << sw << "x" << sh;

     screenshot = screenshot.scaled( sw *= 2, sh *= 2 );

I got:

screenshot size: 1596 x 841

@Ho-Ro
Copy link
Member

Ho-Ro commented Mar 4, 2023

Ok, you get the downscaled size and upscale it to the correct 1:1 size.
Now the question, how to know if you're downscaling by 2 (or even by 4)?
A quick solution would be to make it a persistent config option that defaults to 1 and can be changed in the range of e.g. 1..8 - dunno if you have a better idea to detect it automatically.

@espindola
Copy link
Author

Ok, you get the downscaled size and upscale it to the correct 1:1 size. Now the question, how to know if you're downscaling by 2 (or even by 4)? A quick solution would be to make it a persistent config option that defaults to 1 and can be changed in the range of e.g. 1..8 - dunno if you have a better idea to detect it automatically.

Given that the image looks OK when drawing directly (not writing to the QPixmap), Qt must know this somehow (see #353 (comment)) , but I don't know where to look.

Ho-Ro added a commit that referenced this issue Mar 4, 2023
Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
@Ho-Ro
Copy link
Member

Ho-Ro commented Mar 4, 2023

Please try the latest unstable - set scale factor in menu Oscilloscope/Settings/Scope/Upscale exported images

@espindola
Copy link
Author

Please try the latest unstable - set scale factor in menu Oscilloscope/Settings/Scope/Upscale exported images

The resolution is fixed, but some lines are still broken. Compare with #353 (comment)

20230304_190321

@Ho-Ro
Copy link
Member

Ho-Ro commented Mar 4, 2023

Which value did you set? 2?

@espindola
Copy link
Author

Which value did you set? 2?

Yes, 2.

Ho-Ro added a commit that referenced this issue Mar 5, 2023
@Ho-Ro
Copy link
Member

Ho-Ro commented Mar 5, 2023

strange, then it should give the same result as your

+
+    screenshot = screenshot.scaled( sw *= 2, sh *= 2 );
+

But now another shot in the dark -> new unstable (1e7788b)

@espindola
Copy link
Author

But now another shot in the dark -> new unstable

Fixed!
20230305_144845

@Ho-Ro Ho-Ro closed this as completed in a08dc4b Mar 5, 2023
@Ho-Ro
Copy link
Member

Ho-Ro commented Mar 6, 2023

@Vascom @iss000 Please double check also with your HiDPI setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HiDPI Display issues in HiDPI mode
Projects
None yet
Development

No branches or pull requests

4 participants