Bug 308143

Summary: xcf preview failed after upgrading to 4.8+
Product: [Unmaintained] kdelibs Reporter: Matias Morawicki <matiasmorawicki>
Component: kimgioAssignee: Christoph Feck <cfeck>
Status: RESOLVED FIXED    
Severity: normal CC: cfeck, msx, rtalbot
Priority: NOR    
Version: 4.8   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 4.10
Sentry Crash Report:
Attachments: test xcf notworking
test xcf working
test post 4.9.4 fix. not working file
test post 4.9.4 fix. working file

Description Matias Morawicki 2012-10-09 19:12:10 UTC
After upgrading kde from 4.7 to 4.8 I couldnt preview xcf files any longer.
Using gwenview I get "loading image failed", and in the log I see "Could not generate thumbnail".
I've seen this thread http://forums.opensuse.org/english/get-technical-help-here/applications/472010-kde-4-8-0-gwenview-wont-display-xcf-files-error-while-reading-metadata.html where the workaround is downgrading to 4.7 which Ive done.
It doesnt seem like a gwenview issue since I've kept kde-base in 4.7 and upgraded gwenview to 4.8 and is still working. Same behaviour using 4.9.2.
Thanks for any hints!

Reproducible: Always

Steps to Reproduce:
1.open Gwenview
2.open a folder with gimp xcf files
3.double click a .xcf file
Actual Results:  
 I get "loading image failed", and in the log I see "Could not generate thumbnail".

Expected Results:  
show a preview of the gimp xcf image.

it started happening when upgrading from kde 4.7 to 4.8, but its still happening with 4.9.2
I've downgraded to 4.7 where is working normally.
Comment 1 Christoph Feck 2012-10-09 20:14:25 UTC
Can you reproduce the problem with a freshly created user account? Does it happen with all .xcf files?

I quickly tested with those from the calligra test suite, and gwenview (from KDE 4.9.2) could load them all. See https://projects.kde.org/projects/calligra/repository/revisions/master/show/krita/plugins/formats/xcf/tests/data/sources

If it only works with specific files, please attach a file that does not work.
Comment 2 Christoph Feck 2012-10-13 13:55:24 UTC
If you can provide the information requested in comment #1, please add it.
Comment 3 Matias Morawicki 2012-10-14 00:00:14 UTC
(In reply to comment #1)
> Can you reproduce the problem with a freshly created user account?

yes, it happens  with a freshly created user account.

> Does it happen with all .xcf files?
it does with all new xcf files. If a folder contains a .xcf that has been already previewed, it shows the preview from the cache (I think)

let me know any other tests...
cheers
Comment 4 Christoph Feck 2012-10-15 08:58:59 UTC
Thanks for the update, I have no idea why it works here, but not on your system.
Comment 5 Matias Morawicki 2012-10-19 00:23:14 UTC
(In reply to comment #4)
> Thanks for the update, I have no idea why it works here, but not on your
> system.

It doenst in both my pcs (archlinux both). I thought it could be a misconfigutraion issue until I saw the post mentioned on the first comment where people using opensuse were experiencing the same.
Comment 6 Christoph Feck 2012-10-19 07:44:02 UTC
Setting status correctly.
Comment 7 Martín Cigorraga 2012-11-01 14:05:54 UTC
Hi all,
same issue as @Mattas here.

Running an up-to-date KDE SC 4.9.2 on Arch Linux x86_64.
Comment 8 Jekyll Wu 2012-11-03 09:52:06 UTC
*** Bug 309465 has been marked as a duplicate of this bug. ***
Comment 9 Christoph Feck 2012-11-06 11:20:31 UTC
Does opening those .xcf files work in kolourpaint?
Comment 10 Martín Cigorraga 2012-11-06 16:19:03 UTC
@Cristoph: yes, no problem opening any .xcf file with KolourPaint 4.9.2
Comment 11 Christoph Feck 2012-11-06 20:49:23 UTC
Thanks, so the xcf loader in kdelibs actually works. No idea why other programs fail to load .xcf files. Maybe the list of allowed extensions has been changed in those applications?

Can someone check, which applications work, and which do not? The bug here is reported for digiKam and gwenview. Can you confirm? What about Dolphin thumbnail previews?
Comment 12 Martín Cigorraga 2012-11-08 17:25:42 UTC
* UPDATE *
.xcf files works with KolourPaint, Dolphin previews, Plasma Desktop Files previews, showFoto, DigiKam... and now Gwenview :P

Besides the usual system update stuff I don't what have changed but now everything is working okay on Arch Linux 4.9.2.

Anyone else? Please confirm.
Comment 13 Matias Morawicki 2012-11-08 22:44:10 UTC
(In reply to comment #12)
> * UPDATE *
> .xcf files works with KolourPaint, Dolphin previews, Plasma Desktop Files
> previews, showFoto, DigiKam... and now Gwenview :P
> 
> Besides the usual system update stuff I don't what have changed but now
> everything is working okay on Arch Linux 4.9.2.
> 
> Anyone else? Please confirm.

Im seeing some strange behaviour. Gwenview seems to be able to preview some new files but some others no. 
I've tried saving a working file with a different name and wont work.
I tried deleting gwenview's recent folder and .thumbnails but nothing new.
Kolourpaint follows the same results, the files working in gwenview open in kolourpaint, and the ones 
not previewing in gwenview give this error "Could not open "TEST4.xcf" - unsupported image format.
The file may be corrupt.".
If I save a new test file with just a plain color layer the preview works, but if I add a layer with some transparency and save over, again I get the error.
could it be related to Gimp version? Im using 2.8.0, and tried with 2.8.2 but seeing similar results with both.
Comment 14 Christoph Feck 2012-11-08 22:57:01 UTC
If you can attach an .xcf file that KolourPaint cannot open, I can check, if it is indeed corrupt.
Comment 15 Matias Morawicki 2012-11-08 23:09:29 UTC
Created attachment 75113 [details]
test xcf notworking
Comment 16 Matias Morawicki 2012-11-08 23:12:37 UTC
Created attachment 75114 [details]
test xcf working
Comment 17 Christoph Feck 2012-11-09 00:37:02 UTC
Thanks, it is a file with a layer larger than the image. The commit for bug 234030 added a check to not load those files, because they were treated as corrupt. Removing the check makes it load. I will improve the checks for 4.9.4 release.
Comment 18 Martín Cigorraga 2012-11-09 03:01:19 UTC
Good news, thank you =)
Comment 19 Matias Morawicki 2012-11-09 23:28:59 UTC
great!! cheers!!
Comment 20 Christoph Feck 2012-11-24 22:58:01 UTC
Git commit b26309ebb120aceb2cdd4dc26925f4c786d70673 by Christoph Feck.
Committed on 24/11/2012 at 23:52.
Pushed by cfeck into branch 'KDE/4.9'.

Add tolerance to layer size sanity check

Commit for bug 234030 caused a regression with images
that have layers larger than the canvas.

The factor 2 is arbitrary, but is hopefully sufficient.
FIXED-IN: 4.9.4

M  +1    -1    kimgio/xcf.cpp

http://commits.kde.org/kdelibs/b26309ebb120aceb2cdd4dc26925f4c786d70673
Comment 21 Martín Cigorraga 2012-11-24 23:24:39 UTC
Awesome, thank you!
Comment 22 Matias Morawicki 2012-12-15 14:47:30 UTC
just updated to 4.9.4!! working flawlessly!!
nice one!!!!
Comment 23 Matias Morawicki 2013-01-06 22:38:45 UTC
(In reply to comment #20)
> Git commit b26309ebb120aceb2cdd4dc26925f4c786d70673 by Christoph Feck.
> Add tolerance to layer size sanity check
> > Commit for bug 234030 caused a regression with images
> that have layers larger than the canvas.
> > The factor 2 is arbitrary, but is hopefully sufficient.
> FIXED-IN: 4.9.4

Hi, sorry to bring this issue back, but I'm still having issues with some files. I believe its related to the factor set in the 4.9.4 fix.
I enclose two sample files.
Thanks again!
Comment 24 Matias Morawicki 2013-01-06 22:41:56 UTC
Created attachment 76257 [details]
test post 4.9.4 fix. not working file
Comment 25 Matias Morawicki 2013-01-06 22:44:10 UTC
Created attachment 76258 [details]
test post 4.9.4 fix. working file
Comment 26 Christoph Feck 2013-01-06 23:27:04 UTC
Yes, the image is 1000x1000, the layer is 2200x1400. What is the reason for layers larger than the image, i.e. what workflow creates those files?
Comment 27 Matias Morawicki 2013-01-07 00:56:36 UTC
(In reply to comment #26)
> Yes, the image is 1000x1000, the layer is 2200x1400. What is the reason for
> layers larger than the image, i.e. what workflow creates those files?

-I usually add photos straight from the camera to web sized files and use just parts of the photos, make an export and then move the photos to another parts, export and so on.
-Also I make designs that I later use in blender, and I use a same xcf to test different screenshots or test-frames, so I need big layers to move around and try several settings.
Comment 28 Christoph Feck 2013-01-08 00:38:42 UTC
How big? Instead of using a factor, I should probably hardcode a safe maximum size for a layer. I did not find any limitation imposed by GIMP itself, so I have to select a sane limit. Would 16384x16384 be enough? That's already 2 GB memory used to load the layer.
Comment 29 Matias Morawicki 2013-01-08 00:53:24 UTC
(In reply to comment #28)
> How big? Instead of using a factor, I should probably hardcode a safe
> maximum size for a layer. I did not find any limitation imposed by GIMP
> itself, so I have to select a sane limit. Would 16384x16384 be enough?

Interesting point. I have used files (and layers) of more than 20000 pixels wide, but probably you wouldnt want to preview those... :P
Comment 30 Christoph Feck 2013-01-27 13:46:22 UTC
Git commit 16f4dc07334af5a0eca754868eafd89e7908e2b3 by Christoph Feck.
Committed on 27/01/2013 at 14:39.
Pushed by cfeck into branch 'KDE/4.10'.

Even more tolerance in layer size sanity check

Appearantly, there are files out there with layers much
larger than the actual image. The layer size is now checked
against larger limits (32K in each dimension, 256M total).
FIXED-IN: 4.10

M  +1    -1    kimgio/xcf.cpp

http://commits.kde.org/kdelibs/16f4dc07334af5a0eca754868eafd89e7908e2b3