Bug 451681

Summary: Scan and refresh of album don't rotate HEIC files correctly.
Product: [Applications] digikam Reporter: Björn <bjornh>
Component: Thumbs-IconViewAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, kde-bugs.mail.postfach144, metzpinguin
Priority: NOR    
Version First Reported In: 7.7.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 7.7.0
Sentry Crash Report:
Attachments: Screenshot of rotate error
Example heic file

Description Björn 2022-03-19 09:51:29 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Open DigiKam (digiKam-7.7.0-20220318T190205-Win64)
2. Select directory with heic-files
3. Run menu command refresh

OBSERVED RESULT
All images are presentet in landscape orientation

EXPECTED RESULT
Images should be orientades as the shot portrait or landskape as it worked in DigiKan version 7.6

SOFTWARE/OS VERSIONS
Windows: 11
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Björn 2022-03-19 09:57:54 UTC
When I open the catalog in DigiKam 7.6 the images are still all in landscape orientation.
When I refresh the folder (in DigiKam 7.6) the orientation change to as shot portrait/landscape.
If a open the catalog in DigiKam 7.7 the orientation of images are still correct, as it was in v7.6 
e.a. the presetation are correct but the scanning has some error in v7.7
Comment 2 caulier.gilles 2022-03-19 10:32:33 UTC
Did you talk about thumbnails view, or the preview (F3) ?
Comment 3 caulier.gilles 2022-03-19 10:33:19 UTC
Also can you shared view HEIF samples to test ?

Can you take a screenshot of the problem ?

Thanks in advance
Comment 4 Maik Qualmann 2022-03-19 11:08:02 UTC
I can reproduce the problem. Since we are now using an external libheif, which is probably a bit more up-to-date, each image is already rotated as with the RAW decoder. If our loader now rotates the image, it is incorrectly rotated.

Maik
Comment 5 Björn 2022-03-19 11:23:39 UTC
Created attachment 147593 [details]
Screenshot of rotate error

After refresh in DigiKam 7.7
Portrait images are displayed in landscape in tumbnail view
Comment 6 Björn 2022-03-19 11:26:11 UTC
Created attachment 147594 [details]
Example heic file

Example heic file in portrait format that is scanning in digicam 7.6 in correct orientation but in Digicam 7.7 scanning to landscape
Comment 7 Maik Qualmann 2022-03-19 11:56:12 UTC
We already disable the internal rotation, but it has no impact here with Libheif-1.12.0, we always get a rotated image.

struct heif_decoding_options* const decode_options = heif_decoding_options_alloc();
decode_options->ignore_transformations             = 1;

Maik
Comment 8 Maik Qualmann 2022-03-19 12:50:01 UTC
Ok, the cause is the old libheif-1.12.0 used, which is used on both Windows and openSUSE Tumbleweed. The bug was fixed a few days after it was released in May 2021.

https://github.com/strukturag/libheif/commit/31d44edbb237182e8a0f5fee586011e7aa821c66

Maik
Comment 9 caulier.gilles 2022-03-19 14:02:51 UTC
So we need to take a care of libheif version in digiKam code. Cmake must set a variable with the libheif version detected.

Gilles
Comment 10 Maik Qualmann 2022-03-19 14:08:52 UTC
For Windows, we could check out the master code. Unfortunately master still returns 1.12.0 to do a workaround für another platforms.

Maik
Comment 11 caulier.gilles 2022-03-20 06:32:57 UTC
ok, i wiil patch all bundle to use libheif as rolling release.

Gilles
Comment 12 caulier.gilles 2022-03-21 11:04:34 UTC
Git commit 8d341716f1419903b7a8218062f2b0aceecd6593 by Gilles Caulier.
Committed on 21/03/2022 at 10:52.
Pushed by cgilles into branch 'qt5-maintenance'.

Switch all bundles to libheif rolling release with git/master code.
Separate libde265 and libaom compilation rules using 2 different targets. Both are compiled before libheif and libavif.
FIXED-IN: 7.7.0

M  +2    -0    project/bundles/3rdparty/CMakeLists.txt
M  +38   -40   project/bundles/3rdparty/ext_heif/CMakeLists.txt
D  +0    -21   project/bundles/3rdparty/ext_heif/de265-lib-mxe.patch
D  +0    -38   project/bundles/3rdparty/ext_heif/heif-lib-linux.patch
D  +0    -38   project/bundles/3rdparty/ext_heif/heif-lib-mxe.patch
A  +12   -0    project/bundles/3rdparty/ext_heif/heif-lib-only.patch
A  +81   -0    project/bundles/3rdparty/ext_libaom/CMakeLists.txt
M  +3    -70   project/bundles/3rdparty/ext_libavif/CMakeLists.txt
C  +15   -37   project/bundles/3rdparty/ext_libde265/CMakeLists.txt [from: project/bundles/3rdparty/ext_heif/CMakeLists.txt - 056% similarity]
R  +0    -0    project/bundles/3rdparty/ext_libde265/libde265-lib-only.patch [from: project/bundles/3rdparty/ext_heif/de265-lib-linux.patch - 100% similarity]
M  +2    -1    project/bundles/appimage/01-build-host.sh
M  +2    -0    project/bundles/appimage/03-build-digikam.sh
M  +1    -1    project/bundles/macports/01-build-macports.sh
M  +3    -2    project/bundles/mxe/01-build-mxe.sh
M  +2    -0    project/bundles/mxe/03-build-digikam.sh

https://invent.kde.org/graphics/digikam/commit/8d341716f1419903b7a8218062f2b0aceecd6593
Comment 13 Hans 2022-09-26 22:05:06 UTC
It seems to me this bug still exists. I'm using digiKam 7.8.0 on openSUSE Tumbleweed. HEIC files in portrait orientation are displayed in landscape orientation, no matter if as thumbnail, as preview or in the editor. They open correctly in Gwenview and GIMP.

Reopen?
Comment 14 Maik Qualmann 2022-09-27 04:32:55 UTC
openSUSE Tumbleweed is still on libheif-1.12. Since libheif-1.13 was released recently, the bug will not be fixed until the current version.

Maik