Bug 275078 - Fit to window size not working if image is smaller then window size. Add a new option for zooming in preview [patch]
Summary: Fit to window size not working if image is smaller then window size. Add a ne...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Preview-Image (show other bugs)
Version: 5.4.0
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-06 22:57 UTC by AT
Modified: 2023-05-11 05:48 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.1.0
Sentry Crash Report:


Attachments
Gwenview Not Fitted (84.36 KB, image/jpeg)
2023-05-09 12:33 UTC, Evert Vorster
Details
Gwenview Fitted (235.72 KB, image/jpeg)
2023-05-09 12:34 UTC, Evert Vorster
Details
Digikam Fit (167.82 KB, image/jpeg)
2023-05-09 12:34 UTC, Evert Vorster
Details
Gwenview Settings (193.88 KB, image/jpeg)
2023-05-09 12:40 UTC, Evert Vorster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description AT 2011-06-06 22:57:11 UTC
Version:           2.0.0 (using KDE 4.6.2) 
OS:                Linux

DigiKam 2.0.0 beta6
My setup is german, so actual english names of things might differ from my translations.

If I use View--> fit to window size, images stay at or revert to their original size, effectively doing the same as View --> show original size. same with a keyboard shortcut.

Reproducible: Always

Steps to Reproduce:
using View --> fit to window size (or appropriate shortcut) on an image that's not at it's original size.

Actual Results:  
Sets image to original size.

Expected Results:  
Fit image to window size.
Comment 1 Marcel Wiesweg 2011-06-19 16:15:08 UTC
For me this is WONTFIX because intended: Fit-to-window is for the usual case of large images. With small images, like icons, zooming in automatically is often not desired, if the image is really small you'll having nothing but a zoom artifact.
Comment 2 AT 2011-06-19 20:34:37 UTC
As DigiKam doesn't actually automatically zoom in (at least it didn't before 2.0), it would be still up to the individual user if he wants to blow the image up to fullscreen. I find it fairly usefull to see if an image that's not quite as big as my screen still looks nice, especially in fullscreen mode. And the old behaviour just was faster then using then + key at times.
At least the name should be changed then, because 'fit image to window size' conveys the message it's increasing the image if it is smaller then the window, or reduce it if it's bigger. And it shouldn't reset an image zoomed to window size back to it's original size either in my opinion.
Comment 3 caulier.gilles 2014-08-29 21:48:10 UTC
AT,

This problem still valid using digiKam 4.2.0 ?

Gilles Caulier
Comment 4 AT 2014-09-05 21:53:29 UTC
Behaviour is unchanged - images smaller then the window stay small, or if they had been zoomed, they revert to their original size.
If I interpret Marcel's comment correctly, this behaviour is supposed to be a feature. And by looking at this bug report I'm probably the only one missing the old behaviour. :-P ;-)
Comment 5 caulier.gilles 2015-05-16 10:07:12 UTC
At,

What's about this file using digiKam 4.10.0 ?

Gilles Caulier
Comment 6 caulier.gilles 2016-07-06 16:31:10 UTC
This file still valid using last digiKam 5.0.0 ?

Gilles Caulier
Comment 7 caulier.gilles 2016-11-29 11:28:17 UTC
Can you reproduce the problem using digiKam Linux AppImage bundle ? The last
bundle is available at this url:

https://drive.google.com/drive/folders/0BzeiVr-byqt5Y0tIRWVWelRJenM

Gilles Caulier
Comment 8 AT 2016-12-11 19:13:20 UTC
Hi there, 

sorry I didn't pick up on the last comments. Kind of missed them though I'm sure I must have read the mail notification.

Yes, behaviour is unchanged with digikam-5.4.0-01-x86-64.appimage (dito with digikam-5.3 on sabayon).
Comment 9 Kamo 2020-02-27 14:16:13 UTC
Will it be possible to add an option to 'stretch the smaller images to fit windows'?

One of the image viewers called Honeyview actually supports this function and it's very useful. The monitor resolutions are getting higher and higher and many of my old photos look too small now.
Comment 10 Maik Qualmann 2020-02-27 21:46:07 UTC
The screen resolutions increase... but an old photo becomes blurred the larger you zoom it. Even if Marcel's Comment 1 is older, I fully agree.

Maik
Comment 11 Kamo 2020-02-29 23:40:15 UTC
True, it will look blurry if you zoom in, but obviously there are people who prefer bigger view and care less about how blurry it is. I'm not saying it should be 'fixed' or anything, just saying it would be great to have as an option. (Unless it's technically difficult to implement or something like that, of course.)
Comment 12 Maik Qualmann 2020-08-14 22:41:40 UTC
*** Bug 425342 has been marked as a duplicate of this bug. ***
Comment 13 Qian 2021-03-06 08:24:29 UTC
After my patch in https://bugs.kde.org/show_bug.cgi?id=434049 is applied, together with this following patch, we can have "fit to window" to always fit to window, instead of current behavior.

Developers, this is 2021 now, where 4K screen is more and more popular.  So viewing a 1 million pixel picture on a 8 million pixel screen is not that uncommon.  Also, zoom such pictures on this hiDPI screen is not blurry at all.

The old behavior can be achieved via a manually set fixed 100% zoom level.

--- a/core/libs/widgets/graphicsview/previewlayout.cpp
+++ b/core/libs/widgets/graphicsview/previewlayout.cpp
@@ -259,7 +259,7 @@ void SinglePhotoPreviewLayout::fitToWindow()
 
     d->isFitToWindow = true;
 
-    d->zoomSettings()->fitToSize(d->frameSize(), ImageZoomSettings::OnlyScaleDown);
+    d->zoomSettings()->fitToSize(d->frameSize(), ImageZoomSettings::AlwaysFit);
     d->item->sizeHasChanged();
     updateLayout();
     d->item->update();
Comment 14 Maik Qualmann 2021-03-06 14:48:50 UTC
The discussion is quite old and exist also for Gwenview, because Gwenview doesn't zoom in any small images either. The whole thing has nothing to do with 4k and high resolutions. We also have users who use digiKam to manage graphics and icons. I have just tested it with your patch, zooming in is not suitable for graphics. It doesn't always look pixelated, but your suggestion is to go 100% to get the old behavior back. This is ok as long as the graphics are smaller, with larger graphics you have to select fit to window each time. For me it is clear that this behavior has to be configurable.

Maik
Comment 15 Qian 2021-03-06 15:13:31 UTC
Yes, a configurable option is the right way to do things.

Anyway, I can apply this patch locally on my system, or use fullscreen instead as a workaround.
Comment 16 Jens Ramke 2021-03-06 15:45:46 UTC
There is nothing inherently wrong with pixelation or blurriness. It's just the result of a resampling algorithm (e.g. Nearest neighbor for pixelation) and can be desired depending on the use case.

The behavior (i.e. "zoom" level) and algorithm should be configurable separately for sub- and super-sampling.
Ideally in a way that can be easily adopted by Gwenview and others.
Comment 17 Evert Vorster 2023-05-09 12:33:30 UTC
Created attachment 158794 [details]
Gwenview Not Fitted

Screenshot of Gwenview with fit image not clicked
Comment 18 Evert Vorster 2023-05-09 12:34:10 UTC
Created attachment 158795 [details]
Gwenview Fitted

Screenshot of Gwenview with "Fit" clicked
Comment 19 Evert Vorster 2023-05-09 12:34:56 UTC
Created attachment 158796 [details]
Digikam Fit

This is what the image looks like in DigiKam, whether fit has been clicked or not.
Comment 20 Evert Vorster 2023-05-09 12:38:14 UTC
This IS a VERY old discussion, but as screen resolutions keep increasing, it only becomes more relevant, instead of less relevant. 

Gwenview now assumes that "Fit" means fit the image to the window, which means that it would scale larger images smaller to fit, as well as scale smaller images larger to fit.  (attached screenshots to show)

For DigiKam, there is already a "Zoom to 100%" button, that would make small images appear small, and large images appear large. It would only make sense to now make "Fit to window" to actually make small images fit to larger windows as well. This issue has been bugging me for a long time, as it's really annoying to have to set the zoom scale for small images.

Because people have been asking for this for a long time, it is a requested feature. Of course some people don't want small images enlarged, and that's fine too. Why not simply have a configuration option in settings that states "Enlarge smaller images to fit window"?
People who don't like to see small images enlarged can leave it off, and people who would want their images enlarged can switch it on.

This would satisfy both use cases for minimum effort.
Comment 21 Evert Vorster 2023-05-09 12:40:04 UTC
Created attachment 158798 [details]
Gwenview Settings

Screenshot of the Gwenview settings dialog, which has exactly this setting suggested in my comment
Comment 22 Maik Qualmann 2023-05-10 20:08:21 UTC
Git commit 0d0ea857da42b34220c7460bd9359fc5a79922c5 by Maik Qualmann.
Committed on 10/05/2023 at 20:07.
Pushed by mqualmann into branch 'master'.

add option to scale always small images to fit to window
FIXED-IN: 8.1.0

M  +1    -1    NEWS
M  +3    -0    core/app/views/preview/itempreviewview.cpp
M  +2    -0    core/libs/settings/applicationsettings.cpp
M  +3    -0    core/libs/settings/applicationsettings.h
M  +10   -0    core/libs/settings/applicationsettings_iconview.cpp
M  +3    -0    core/libs/settings/applicationsettings_p.cpp
M  +2    -0    core/libs/settings/applicationsettings_p.h
M  +14   -7    core/libs/widgets/graphicsview/graphicsdimgview.cpp
M  +1    -0    core/libs/widgets/graphicsview/graphicsdimgview.h
M  +30   -18   core/libs/widgets/graphicsview/previewlayout.cpp
M  +5    -0    core/libs/widgets/graphicsview/previewlayout.h
M  +10   -3    core/utilities/setup/album/setupalbumview.cpp

https://invent.kde.org/graphics/digikam/commit/0d0ea857da42b34220c7460bd9359fc5a79922c5
Comment 23 caulier.gilles 2023-05-11 05:48:03 UTC
Git commit 24b751944732897643662e604066ea822e9cac66 by Gilles Caulier.
Committed on 11/05/2023 at 05:46.
Pushed by cgilles into branch 'master'.

Online documentation: add new option to enlarge small image to the canvas size.
Related: bug 425342

M  +-    --    setup_application/images/setup_album_preview.webp
M  +3    -1    setup_application/views_settings.rst

https://invent.kde.org/documentation/digikam-doc/commit/24b751944732897643662e604066ea822e9cac66