-
Notifications
You must be signed in to change notification settings - Fork 123
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
Pictures are scaled above window size (some pixels) #627
Comments
This is, unfortunately, intentional behavior because there are various places in which small rounding errors can occur. If we try to calculate the ideal zoom ratio to get the image fit perfectly inside the window, it could end up slightly smaller than expected, resulting in the image not quite touching the edge of the window and a pixel or so of the background color showing around the edge. If it's even possible to fix, it would likely be very difficult, so this is the tradeoff that was made. That said, it could at least be configurable in case a user wants to make a different tradeoff. I just implemented it in my fork as the "overscan" setting in the Image tab (build here). Official qView uses 2 pixels but I reduced the default to 1. It can even be set negative to bring the image further inside the viewport if you want to for whatever reason (could be useful if you're bothered about macOS's rounded corners cutting off pixels around the bottom 😋). As with some other things I've implemented, probably not official qView material due to concerns of the settings UI getting too confusing, but maybe one day if there were an "Expert Mode" in the settings 😄. |
Hello Bye |
I worked on this more today and surprisingly managed to figure out and fix just about all the issues that caused accuracy problems in the automatic window sizing and zoom-to-fit code. There is just one thing out of our control, specifically, when Qt does scaling for high DPI displays, the window size is represented in an abstracted way (device independent pixels). With 200% scaling, for example, a window that Qt represents as 100x100 gets rendered on the screen as 200x200. If we wanted the window to be 201 pixels wide, we could tell Qt to set its width to 100 or 101 device independent pixels, resulting in an actual width of 200 or 202 pixels respectively, but there's no way (as far as I can tell) to get exactly 201. So it's inevitable to be off by 1 pixel in some cases, but I think I've managed to get it accurate enough now that I am comfortable having the overscan setting default to 0 pixels. Worst case there is just one pixel of background showing and it tends to blend in with the window frame anyway (unless you use a bright red background color or something 😄 as I did for testing), which isn't really bothersome in my opinion. Considering that, I think this could be fixed in the official qView even without the need for a configurable overscan setting. |
Hello Greetings |
"Image resizes past actual size" is an existing setting from official qView and it controls something different, but yes it is pretty confusing especially because I put my new setting right below it. The checkbox means basically "images smaller than the minimum window size get stretched to fill the window". So if for example qView doesn't want to make the window smaller than 300 pixels wide (controlled by the "minimum size" setting on the Window tab), but you open a 100 pixel wide image, "image resizes past actual size" controls whether qView zooms to 300% or 100% in that case. |
Environment:
Hello
My pictures all have a thin white (outer) and black (inner) border of 6 pixels on three sides and a thicker one at the bottom. And even when the setting "Scaling above window size" is inactive I can clearly see that the border is missing at the sides hitting the window border. You can see it in the screenshot. So the images are scaled al little bit out of the window or thewindow borders are covering them.
By the way:
I was happy to see that qView is now aware of monitor profiles. That was the only reason held me back from using it. Good job!
screenshots:
picture file:
Greetings
Marcus
The text was updated successfully, but these errors were encountered: