Inline rendering/thumbnailing for Gimp XCF images
Closed, ResolvedPublic

Description

Some images on Wikipedia/Commons/etc have been uploaded in Gimp's XCF format; as a work format this is pretty good since it supports multiple layers, editable text, various effects etc -- and Gimp is free software, so anyone can download it and edit the source file.

However, we don't currently support in-wiki rendering of the XCF files, so you need to separately upload a flattened PNG or JPEG file.

To save this extra manual step and simplify the workflow, XCF images could be rendered by shelling out to Gimp, or with alternate loaders such as this GdkPixBuf loader: http://blog.reblochon.org/2009/03/gift-to-competition.html


Version: unspecified
Severity: enhancement
URL: http://commons.wikimedia.org/wiki/File:Wikiball.xcf

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz17959.
brion created this task.Via LegacyMar 12 2009, 7:56 PM
bzimport added a comment.Via ConduitMar 16 2009, 7:30 PM

ahmad.m.sherif wrote:

proposed patch

This patch may help. It uses one of xcftools software, xcf2png, which works only on linux and unix-like systems.

attachment xcf.patch ignored as obsolete

brion added a comment.Via ConduitMar 16 2009, 9:06 PM

Looks like this package:
http://henning.makholm.net/xcftools/

Good news:

  • xcftools package is included in Debian and Ubuntu -- would be easy to deploy to image scaler boxes!

Bad news:

  • Site's down and last release seems to be in 2006; unmaintained software? :(
  • xcf2png does not appear to do scaling itself. The attached patch does post-scaling with GD, which will fail when GD is not available; it also seems to be rendering to stdout and buffering the whole thing into PHP-managed memory, making it more likely to fail on large images.

If we can't skip the step on scaling, might be safer to output to a temporary file and then scale that, potentially with ImageMagick or whatever the default for rasters is.

I haven't done any testing yet to confirm compatibility on xcf2png.

bzimport added a comment.Via ConduitMar 20 2009, 10:38 PM

ahmad.m.sherif wrote:

another patch and a python script

Bad news:

  • Site's down and last release seems to be in 2006; unmaintained software? :(
  • xcf2png does not appear to do scaling itself. The attached patch does post-scaling with GD, which will fail when GD is not available; it also seems to be rendering to stdout and buffering the whole thing into PHP-managed memory, making it more likely to fail on large images.

So we can use the Pixbuf loader mentioned above in association with a simple script (e.g. python with gdk bindings) to eliminate this problem.

Good news:

  • xcftools package is included in Debian and Ubuntu -- would be easy to deploy to image scaler boxes!

It's easy to deploy this loader but not as easy as xcftools :). i think that this loader may help doing the work under windows too.

attachment xcf.zip ignored as obsolete

bzimport added a comment.Via ConduitMar 20 2009, 11:13 PM

mike.lifeguard+bugs wrote:

Could you please attach the patch separately from anything else? Otherwise, we cannot view it on bugzilla.

bzimport added a comment.Via ConduitMar 20 2009, 11:16 PM

ahmad.m.sherif wrote:

the patch

attachment xcf2.patch ignored as obsolete

bzimport added a comment.Via ConduitMar 20 2009, 11:18 PM

ahmad.m.sherif wrote:

python script to interact with pixbuf loader

Attached: pyxcf

bzimport added a comment.Via ConduitMar 23 2009, 10:34 PM

ahmad.m.sherif wrote:

adding a missing line

Adding a missing line wasn't in the first patch.

Attached: xcf3.patch

Peachey88 added a comment.Via ConduitApr 30 2011, 12:10 AM

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

bzimport added a comment.Via ConduitNov 10 2011, 6:42 AM

sumanah wrote:

Ahmad, thank you for your patches, and my apologies on the late response. I've added the "need-review" keyword to indicate that developers should review your code.

Bawolff added a comment.Via ConduitNov 10 2011, 5:41 PM

Comment on attachment 5946
python script to interact with pixbuf loader

To start with, an XCFHandler, should probably be an extension and not in core (but that's really a trivial change, and not a major issue with the patch).

(also changing mime type on python file so that hopefully it is not forced-download)

MarkAHershberger added a comment.Via ConduitDec 26 2011, 6:56 PM

Check out https://en.wikipedia.org/wiki/File:%22What_a_Brilliant_Idea!%22_Barnstar.xcf for an example file. (Found this while investigating another bug.)

ImageMagick will work with this. I have a bit of work done that will work with convert.

brion added a comment.Via ConduitDec 26 2011, 7:01 PM

Sounds like we need two things:

  • a PHP-native 'getimagesize' implementation for XcfHandler to extract the width/height of the contained image from the file header
  • wrappers for calling ImageMagick's convert and/or the gdkpixbuf loader to generate scaled PNGs

Mark, can you post what you have on the bug or check in an initial XcfHandler extension? This'd be handy to have. :)

Bawolff added a comment.Via ConduitDec 26 2011, 11:18 PM

Created attachment 9764
Rendering of File:%22What_a_Brilliant_Idea!%22_Barnstar.xcf with ImageMagick vs GIMP

(In reply to comment #11)

Check out
https://en.wikipedia.org/wiki/File:%22What_a_Brilliant_Idea!%22_Barnstar.xcf
for an example file. (Found this while investigating another bug.)

ImageMagick will work with this. I have a bit of work done that will work with
convert.

Perhaps my version of ImageMagick is outdatated, but it seems not to support lots of the features of GIMP. See screenshot. OTOH, arguably it might be better to have crappy thumbnailing than no thumbnailing.

Relevant versions:

bawolff@Bawolff-L:~$ gimp --version
GNU Image Manipulation Program version 2.6.10

bawolff@Bawolff-L:~$ display --version
Version: ImageMagick 6.6.0-4 2010-11-16 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP

Attached:

MarkAHershberger added a comment.Via ConduitDec 27 2011, 12:55 AM

r107351

(In reply to comment #12)

  • a PHP-native 'getimagesize' implementation for XcfHandler to extract the width/height of the contained image from the file header

I leave that to someone else. I was lazy and use ImageMagick's identify :P

  • wrappers for calling ImageMagick's convert and/or the gdkpixbuf loader to generate scaled PNGs

Bawolff is right. ImageMagick's support for XCF is buggy. Still what I committed is a start. Maybe use gimp and the stdin script from

http://stackoverflow.com/questions/5794640/how-to-convert-xcf-to-png-using-gimp-from-the-command-line

hashar added a comment.Via ConduitJan 13 2012, 4:14 PM

identify was replaced with a 100% PHP implementation with r108141.

Should we consider this bug as fixed ? :)

MarkAHershberger added a comment.Via ConduitJan 13 2012, 8:49 PM

After talking to people on Commons, doing some sort of thumbnailing for XCF is a start, even with the buggy ImageMagick implementation. Since hashar replaced identify in r108141, we should now start working with the ImageMagick community to improve the thumbnailing.

MarkAHershberger added a comment.Via ConduitJan 13 2012, 9:47 PM

http://commons.wikimedia.beta.wmflabs.org/wiki/File:Tmp4.xcf -- reopening since the main image on the page should have some sort of displayable version like the pdf thumbnails do.

File history is fine, though.

Bawolff added a comment.Via ConduitJan 14 2012, 10:37 PM

Looks fine to me?

Bawolff added a comment.Via ConduitJan 14 2012, 10:42 PM

(In reply to comment #18)

Looks fine to me?

Oh nevermind, i see this was fixed in r107351 by the time i looked at link.

hashar added a comment.Via ConduitJan 15 2012, 11:03 AM

(In reply to comment #17)

the main image on the page should have some sort of displayable version like
the pdf thumbnails do.

Had to force rendering since browsers can not render XCF :-)
r108862

Thanks Bawolff for cross checking.

McZusatz added a comment.Via ConduitMar 30 2012, 5:04 PM

(In reply to comment #16)

After talking to people on Commons, doing some sort of thumbnailing for XCF is
a start, even with the buggy ImageMagick implementation. Since hashar replaced
identify in r108141, we should now start working with the ImageMagick community
to improve the thumbnailing.

Thumbnailing should really be improved. There are some major flaws:
*Grey scale XCF-files become green ( http://commons.wikimedia.org/wiki/File:Australian_English_IPA_vowel_chart.xcf )
*XCF-files with layers get screwed up generally ( http://commons.wikimedia.org/wiki/File:Gimp_layer_mode_test.xcf )

MarkAHershberger added a comment.Via ConduitMar 30 2012, 8:49 PM

(In reply to comment #21)

Thumbnailing should really be improved.

This issue is tracked on Bug 35622

Gilles added a project: Multimedia.Via WebDec 4 2014, 10:54 AM
Gilles moved this task to Closed on the Multimedia workboard.Via WebDec 4 2014, 10:58 AM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.