sylikc / jpegview

Fork of JPEGView by David Kleiner - fast and highly configurable viewer/editor for JPEG, BMP, PNG, WEBP, TGA, GIF and TIFF images with a minimal GUI. Basic on-the-fly image processing is provided - allowing adjusting typical parameters as sharpness, color balance, rotation, perspective, contrast and local under-/overexposure.
Other
2.18k stars 128 forks source link

[BUG] Flickering when zooming #284

Open RndUsr123 opened 9 months ago

RndUsr123 commented 9 months ago

When zooming in/out in steps and zoom > Fit window to image is used, some flickering happens. This is especially obvious at a reduced screen refresh rate and seems to be caused by a render timing issue: the image is moved first and scaled second. This behavior happens when smoothly zooming too, but it's harder to notice. For the record, any zoom-capable device is affected (5 tested).

TCOTC commented 2 months ago

This happened to me too, see GIF :

GIF

RndUsr123 commented 2 months ago

Since this was opened, I've made some progress in identifying the cause: I created a few very simple applications in Python and C# with this feature and I'm positive this is likely a Windows bug!

Before I worked around this issue specifically (more on this later), each of my attempts had presented the very same symptoms of misaligned scaling and moving, thus a jagged appearance. What's interesting, however, is that the one python demo I also tested on MacOS works flawlessly there, with little to no code changes.

While this might very well be caused by a flawed Windows implementation of the Python GUI module I used, my guess is Windows' display composition is sub-par compared to MacOS', so problems arise (from my experience Windows is consistently more choppy in basic operations like window moving and scaling, despite the better hardware).

Luckily, this problem is potentially solvable as I was then able to significantly reduce its visiblity in Python; I did so by changing window size and image size one frame and window position the next, which seems to work consistently. This could be related to some quirk in Python/OpenGL (or my demo app), but it got my hopes up that a fix is possible.

https://github.com/user-attachments/assets/fcdbe575-6835-47bd-9103-a32e49fa27c5

TCOTC commented 2 months ago

cool