Bug 476755

Summary: Digikam git doesn't display layers in XCF files
Product: [Frameworks and Libraries] frameworks-kimageformats Reporter: maderios <leoutation>
Component: generalAssignee: Alex Merry <alex.merry>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, kdelibs-bugs, metzpinguin, mircomir
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: full log and XCF file example
debug log
Added copyright info to XCF

Description maderios 2023-11-09 14:33:37 UTC
Created attachment 162972 [details]
full log and XCF file example

Digikam git doesn't display layers in XCF files, even in thumbnails
See full log and XCF file example in attachment
SOFTWARE/OS VERSIONS
Arch Linux
QT5 5.15.11
Kimageformats 5.111
Comment 1 maderios 2023-11-09 14:37:00 UTC
Created attachment 162973 [details]
debug log
Comment 2 Maik Qualmann 2023-11-09 14:49:56 UTC
You already know from Bug 466821 that the XCF image loader is part of the KImageFormats-Plugins.

Maik
Comment 3 Maik Qualmann 2023-11-09 14:52:44 UTC
You can see from this error message that it is currently not implemented:

kf.imageformats.plugins.xcf: Unhandled mode XCFImageFormat::GIMP_LAYER_MODE_NORMAL

Maik
Comment 4 maderios 2023-11-17 20:57:27 UTC
I discover now PcmanFm-Qt and PcManFM gtk3 can display  multilayers XCF thumbnails, i'm wondering how it works. 
https://archlinux.org/packages/?q=pcmanfm
Comment 5 Maik Qualmann 2023-11-17 21:05:20 UTC
As far as I know, Gimp creates a thumbnail in the thumbnail cache when you save an image. This is displayed by file managers.

Maik
Comment 6 maderios 2023-11-18 11:28:05 UTC
(In reply to Maik Qualmann from comment #5)
> As far as I know, Gimp creates a thumbnail in the thumbnail cache when you
> save an image. This is displayed by file managers.
> 
> Maik

I tested XCF multilayers thumbnails display with other file managers: 
Dolphin 23.08.3 doesn't do it at all
Nautilus 45.1, Thunar 4.18.8, PCmanfm-QT 1.4.0 display these thumbnails...during one second, then strangely, thumbnail disappear...
Only PCmanfm 1.3.2 (Gtk3) can display XCF multilayers thumbnails normally
Comment 7 maderios 2023-11-18 21:10:50 UTC
Issues with XCF layers files is old story. This one was reported more seven years ago
https://bugs.kde.org/show_bug.cgi?id=360806 
Same time, it was reported to ImageMagick team too
https://github.com/ImageMagick/ImageMagick/issues/1544
Dev comment: "Its not a bug. ImageMagick does not support Gimp 2.10 .XCF images. We may support the format in the future but currently we do not have an ETA on when support will be added."
I'm wondering if other soft than  IM, Kimageformats or Graphicsmagick, exist to display XCF files with layers or/and 16 bits XCF files.
Comment 8 Bug Janitor Service 2024-06-08 09:13:02 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kimageformats/-/merge_requests/226
Comment 9 Mirco Miranda 2024-06-08 10:49:51 UTC
(In reply to maderios from comment #0)
> Created attachment 162972 [details]

@maderios are you the author of the image? If yes, can we include it in kimageformat repository as test case?
Comment 10 maderios 2024-06-08 12:08:31 UTC
(In reply to Mirco Miranda from comment #9)
> (In reply to maderios from comment #0)
> > Created attachment 162972 [details]
> 
> @maderios are you the author of the image? If yes, can we include it in
> kimageformat repository as test case?

Yes, I'm the author of these images (Creative Common license), you can include them in kimageformat repository as test case.
Comment 11 Mirco Miranda 2024-06-08 13:29:56 UTC
Created attachment 170272 [details]
Added copyright info to XCF

I added the copyright info you wrote to the XCF and I will include in the KImageFormat repo for the regression tests.
Comment 12 Albert Astals Cid 2024-06-10 20:16:34 UTC
Git commit bd083ff3544e6d4ed8bb1f8c0cac4d9030259088 by Albert Astals Cid, on behalf of Mirco Miranda.
Committed on 10/06/2024 at 20:16.
Pushed by aacid into branch 'master'.

XCF: fixed wrong composite on Grayscale images

A  +-    --    autotests/read/xcf/bug_476755_gray_layers.png
A  +-    --    autotests/read/xcf/bug_476755_gray_layers.xcf
A  +-    --    autotests/read/xcf/bug_476755_rgb_layers.png
A  +-    --    autotests/read/xcf/bug_476755_rgb_layers.xcf
M  +10   -7    src/imageformats/xcf.cpp

https://invent.kde.org/frameworks/kimageformats/-/commit/bd083ff3544e6d4ed8bb1f8c0cac4d9030259088
Comment 13 maderios 2024-06-20 19:47:30 UTC
KimageFormats git version works for me now with 16 bit XCF files, multilayers or not. Bug seems solved.
Qt 6.7.1
KF6 6.3.0