Bug 437706 - Cannot open GIMP XCF files especially when color depth is higher than 8 bits
Summary: Cannot open GIMP XCF files especially when color depth is higher than 8 bits
Status: CONFIRMED
Alias: None
Product: frameworks-kimageformats
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.82.0
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Alex Merry
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-26 17:25 UTC by Syv
Modified: 2022-07-06 11:34 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Syv 2021-05-26 17:25:49 UTC
SUMMARY
Cannot open GIMP XCF files especially when color depth is higher than 8 bits

as described by Gilles Caulier from Digikam

STEPS TO REPRODUCE
1. Open the following gimp image from Digikam

I cannot attach the file since it much larger than 4mb. Here's the link

https://www.sritch.com/pages/cares-20170212-6640.xcf  (96Mb)

OBSERVED RESULT (quote from Gilles Caulier)

..........................
Hi,

Yes problem is fully reproducible here. the Unit test from digiKam trying
to load image report a message from the KImageIO XCF plugin as file is not
recognized :

digikam.dimg: "cares-20170212-6640.xcf" : "QIMAGE" file identified
digikam.dimg.qimage: Can not load " "cares-20170212-6640.xcf" " using DImg::DImgQImageLoader!
digikam.dimg.qimage: Error message from loader: "Unable to read image data"                              <=====!!!!!!!
digikam.dimg: "cares-20170212-6640.xcf" : Unknown image format !!!

This is a problem in the KDE plugin. The problem is the same for both
shared files.

Note  that Exiftool is able to load XCF metadata :

[gilles@localhost dimg]$ exiftool  cares-20170212-6640.xcf
ExifTool Version Number         : 12.00
File Name                       : cares-20170212-6640.xcf
Directory                       : .
File Size                       : 98 MB
File Modification Date/Time     : 2021:05:26 05:13:00+02:00
File Access Date/Time           : 2021:05:26 05:37:17+02:00
File Inode Change Date/Time     : 2021:05:26 05:37:05+02:00
File Permissions                : rw-r--r--
File Type                       : XCF
File Type Extension             : xcf
MIME Type                       : image/x-xcf
XCF Version                     : 12
Image Width                     : 4781
Image Height                    : 3586
Color Mode                      : RGB Color
Compression                     : RLE Encoding
X Resolution                    : 300
Y Resolution                    : 300
Tattoo                          : 2
Units                           : Inches
Metadata Tag Name               : Exif.Canon.0x0003
Metadata Tag                    : 0 0 0 0
Comment                         :
Image Size                      : 4781x3586
Megapixels                      : 17.1

So, please report this problem to KDE bugzilla component
"frameworks-kimageformats". Look like there are already some files open
about XCF support, and especially when color depth is higher than 8 bits.

https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&component=general&list_id=1874818&product=frameworks-kimageformats&query_format=advanced

Best

Gilles Caulier
.........................

SOFTWARE/OS VERSIONS
OS: Manjaro Linux x86_64 
Host: MS-7693 2.0 
Kernel: 5.10.36-2-MANJARO 
Uptime: 3 hours, 13 mins 
Packages: 1542 (pacman) 
Shell: bash 5.1.8 
Resolution: 2560x1080 
DE: Plasma 5.21.5 
WM: KWin 
WM Theme: Breeze 
Theme: Breath2 [Plasma], Breeze [GTK2/3] 
Icons: breath2 [Plasma], breath2 [GTK2/3] 
Terminal: konsole 
Terminal Font: Noto Mono 14 
CPU: AMD FX-8350 (8) @ 4.000GHz 
GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590 
Memory: 1037MiB / 11992MiB 

Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.2.0) on "xcb" 
OS: Manjaro Linux [linux version 5.10.36-2-MANJARO]

Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX

Thank you
Comment 1 Albert Astals Cid 2021-05-26 21:42:52 UTC
That file has two features we don't support:
 * It identifies itself as version 12 and we fail if version > 11
 * It has a layer of type RGB_GIMAGE with bpp 6 and we only support RGB_GIMAGE layers of bpp3

I stopped debugging there, needs someone to put some time into it.

Martin you did the last big-ish refactor in the XCF loader, fancy having a go?

Or maybe you Daniel?
Comment 2 Albert Astals Cid 2021-05-26 22:00:07 UTC
FWIW https://gitlab.gnome.org/GNOME/gimp/-/blob/master/devel-docs/xcf.txt has a relatively good description of the format
Comment 3 dnovomesky 2021-05-27 10:10:20 UTC
There are more things to do.

I tried to save some XCF files from development GIMP 2.99.7
When option "Save this XCF file with better but slower compression" is selected, kimg_xcf will not load it.

We should also load color profile and set it to QImage via QColorSpace class.
Comment 4 caulier.gilles 2022-07-06 11:34:22 UTC
Hi,

I just checked with digiKam 7.8.0 using KF5 5.95, and a XCF file saved with 16 bits as integer do not render a thumbnail in icon view.

Best

Gilles Caulier