Bug 477795

Summary: Scaled images are jagged
Product: [Applications] digikam Reporter: Per Wigren <per.wigren>
Component: Preview-ImageAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 8.1.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In: 8.3.0
Sentry Crash Report:
Attachments: Clear aliasing when looking at a 33MP photo at screen size
The same image as displayed by XnViewMP with "Spline 36" zoom-out filter

Description Per Wigren 2023-11-30 20:01:37 UTC
Created attachment 163671 [details]
Clear aliasing when looking at a 33MP photo at screen size

It seems like images are always scaled without any filtering such as bicubic or lanczos, making them aliased and ugly when viewing at non-native size. I can't find anywhere to adjust the scaling algorithm. Am I missing something or is this not possible? Attaching an example. It's the same problem in Preview, Slideshow and Fullscreen modes.
Comment 1 Per Wigren 2023-11-30 20:11:13 UTC
Created attachment 163672 [details]
The same image as displayed by XnViewMP with "Spline 36" zoom-out filter
Comment 2 Maik Qualmann 2023-11-30 20:17:52 UTC
You are viewing a reduced preview, this is the default setting for fast loading. Go to digKam settings under Views->Previews and select full image.

Maik
Comment 3 Per Wigren 2023-11-30 20:33:22 UTC
Hi! I should had mentioned, this is a JPEG image, not a RAW. Also, that setting was already checked.
Something that may be related is that the zoom percentage is wrong. In digiKam I need to zoom to 200% to get the same zoom level as 100% in other image viewers like XnViewMP.
Comment 4 Per Wigren 2023-11-30 20:43:55 UTC
Hmm, I tried closing the MacBook and only use the external monitor, then restart digiKam. I normally use both monitors. Then the zoom level in digiKam is normal and it looks like XnViewMP when using the bilinear filter, which is not as good as spline or lanczos but far better than before.

The external monitor is unscaled 3440x1440 and the laptop monitor is a 16" scaled 3456x2234 "retina" screen. So it seems like my digiKam problems come from using two monitors with different resolution/scaling...
Comment 5 Per Wigren 2023-11-30 20:49:46 UTC
Unchecking "Use high DPI scaling from the screen factor" in Miscellaneous -> System seems to fix my problems!
Comment 6 Per Wigren 2023-11-30 20:55:30 UTC
No, I was too quick. The only "fix" seems to be to close the laptop and only use the external monitor. :(
It does look good on the laptop monitor, though, but not on the external monitor when both are active.
Comment 7 Maik Qualmann 2023-11-30 22:00:07 UTC
Hmm, yes, we use QGuiApplication::devicePixelRatio() this gives us the highest screen device pixel ratio in the system. This is bad when different monitors are present in the system. We will change it to determine the current screen that digiKam is currently on.

Maik
Comment 8 Per Wigren 2023-12-01 08:22:04 UTC
That sounds great! Thank you!
Comment 9 Maik Qualmann 2023-12-10 09:04:33 UTC
Git commit f7a18745641e1b35fabcba12cebd14f603f0179c by Maik Qualmann.
Committed on 10/12/2023 at 10:02.
Pushed by mqualmann into branch 'master'.

begin to replace qApp->devicePixelRatio() calls #1

M  +1    -2    core/app/date/monthwidget.cpp
M  +8    -9    core/libs/widgets/graphicsview/graphicsdimgitem.cpp
M  +3    -3    core/libs/widgets/graphicsview/graphicsdimgitem.h
M  +1    -1    core/libs/widgets/metadata/labels/ratingwidget.cpp
M  +7    -7    core/utilities/imageeditor/widgets/imagepreviewitem.cpp

https://invent.kde.org/graphics/digikam/-/commit/f7a18745641e1b35fabcba12cebd14f603f0179c
Comment 10 Maik Qualmann 2023-12-31 13:30:30 UTC
Git commit 412cf318df892fe9b925b2037eae900a018d8061 by Maik Qualmann.
Committed on 31/12/2023 at 14:29.
Pushed by mqualmann into branch 'master'.

replace qApp->devicePixelRatio() calls #2

M  +1    -0    core/libs/widgets/graphicsview/graphicsdimgview.cpp
M  +33   -17   core/libs/widgets/graphicsview/imagezoomsettings.cpp
M  +15   -4    core/libs/widgets/graphicsview/imagezoomsettings.h
M  +2    -0    core/utilities/imageeditor/widgets/imageregionitem.cpp

https://invent.kde.org/graphics/digikam/-/commit/412cf318df892fe9b925b2037eae900a018d8061
Comment 11 caulier.gilles 2023-12-31 14:03:31 UTC
Per,

I started the build of 8.3.0 pre-release PKG installer for MacOS, including last changes from Maik. It will be online in 1 hour at usual place: 

https://files.kde.org/digikam/

Happy new year

Gilles Caulier
Comment 12 Maik Qualmann 2023-12-31 14:08:13 UTC
Git commit d5972a5be2ffedb4fa519743ce82b327b111bac8 by Maik Qualmann.
Committed on 31/12/2023 at 15:07.
Pushed by mqualmann into branch 'master'.

replace qApp->devicePixelRatio() calls #3

M  +1    -1    core/app/views/stack/trashview.cpp
M  +19   -17   core/dplugins/generic/view/glviewer/glviewertexture.cpp
M  +7    -3    core/libs/dtrash/dtrashitemmodel.cpp
M  +2    -1    core/libs/dtrash/dtrashitemmodel.h
M  +1    -1    core/libs/widgets/graphicsview/graphicsdimgview.cpp
M  +11   -11   core/libs/widgets/graphicsview/imagezoomsettings.cpp
M  +2    -2    core/libs/widgets/graphicsview/imagezoomsettings.h
M  +1    -1    core/utilities/imageeditor/widgets/imageregionitem.cpp

https://invent.kde.org/graphics/digikam/-/commit/d5972a5be2ffedb4fa519743ce82b327b111bac8
Comment 13 Maik Qualmann 2023-12-31 18:18:02 UTC
Git commit ed74de1905a1381b0e2af5c59bbb0e495b3008d9 by Maik Qualmann.
Committed on 31/12/2023 at 19:17.
Pushed by mqualmann into branch 'master'.

replace qApp->devicePixelRatio() calls #4

M  +3    -3    core/app/items/delegate/itemdelegate.cpp
M  +2    -2    core/app/items/delegate/itemdelegate.h
M  +1    -1    core/libs/properties/history/versionstreeview.cpp
M  +11   -11   core/libs/widgets/graphicsview/imagezoomsettings.cpp
M  +1    -1    core/libs/widgets/graphicsview/imagezoomsettings.h
M  +6    -6    core/libs/widgets/itemview/ditemdelegate.cpp
M  +2    -1    core/libs/widgets/itemview/ditemdelegate.h
M  +27   -11   core/libs/widgets/itemview/itemviewdelegate.cpp
M  +6    -5    core/libs/widgets/itemview/itemviewdelegate.h
M  +4    -1    core/libs/widgets/itemview/itemviewdelegate_p.h
M  +1    -1    core/showfoto/thumbbar/showfotocategorizedview.cpp
M  +3    -3    core/showfoto/thumbbar/showfotodelegate.cpp
M  +2    -2    core/showfoto/thumbbar/showfotodelegate.h
M  +31   -15   core/showfoto/thumbbar/showfotoitemviewdelegate.cpp
M  +3    -3    core/showfoto/thumbbar/showfotoitemviewdelegate.h
M  +3    -1    core/showfoto/thumbbar/showfotoitemviewdelegate_p.h
M  +3    -3    core/utilities/import/items/importdelegate.cpp
M  +6    -6    core/utilities/import/items/importdelegate.h
M  +28   -12   core/utilities/import/items/itemviewimportdelegate.cpp
M  +13   -12   core/utilities/import/items/itemviewimportdelegate.h
M  +4    -1    core/utilities/import/items/itemviewimportdelegate_p.h
M  +1    -1    core/utilities/import/views/importcategorizedview.cpp

https://invent.kde.org/graphics/digikam/-/commit/ed74de1905a1381b0e2af5c59bbb0e495b3008d9
Comment 14 Maik Qualmann 2023-12-31 19:14:13 UTC
Git commit f50d2bf22ffec3db1661916bb01e47c9c19539b1 by Maik Qualmann.
Committed on 31/12/2023 at 20:13.
Pushed by mqualmann into branch 'master'.

replace qApp->devicePixelRatio() calls #5

M  +14   -12   core/libs/database/history/itemhistorygraphmodel.cpp
M  +1    -1    core/libs/database/history/itemhistorygraphmodel.h
M  +1    -1    core/libs/database/models/itemlistmodel.cpp
M  +1    -1    core/libs/database/models/itemlistmodel.h
M  +8    -5    core/libs/database/models/itemthumbnailmodel.cpp
M  +1    -1    core/libs/database/models/itemthumbnailmodel.h
M  +1    -1    core/libs/models/itemalbummodel.cpp
M  +1    -1    core/libs/models/itemalbummodel.h
M  +18   -14   core/showfoto/thumbbar/showfotothumbnailmodel.cpp
M  +1    -1    core/showfoto/thumbbar/showfotothumbnailmodel.h
M  +1    -1    core/utilities/lighttable/lighttablethumbbar.cpp

https://invent.kde.org/graphics/digikam/-/commit/f50d2bf22ffec3db1661916bb01e47c9c19539b1
Comment 15 Maik Qualmann 2023-12-31 20:02:41 UTC
Git commit 9e1bff9c09e6840df6adcebc1b48d4ffb66bffc6 by Maik Qualmann.
Committed on 31/12/2023 at 21:02.
Pushed by mqualmann into branch 'master'.

replace qApp->devicePixelRatio() calls #6

M  +10   -10   core/app/views/tableview/tableview_column_thumbnail.cpp
M  +4    -3    core/app/views/tableview/tableview_column_thumbnail.h
M  +5    -4    core/app/views/tableview/tableview_columnfactory.cpp
M  +2    -1    core/app/views/tableview/tableview_columnfactory.h
M  +2    -2    core/dplugins/generic/view/slideshow/widgets/slideimage.cpp
M  +1    -1    core/dplugins/generic/view/slideshow/widgets/slideimage.h
M  +3    -3    core/libs/threadimageio/thumb/thumbnailcreator.cpp
M  +3    -3    core/libs/threadimageio/thumb/thumbnailloadthread.cpp

https://invent.kde.org/graphics/digikam/-/commit/9e1bff9c09e6840df6adcebc1b48d4ffb66bffc6