Last modified: 2012-03-30 20:49:39 UTC
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
Created attachment 5937 [details] proposed patch This patch may help. It uses one of xcftools software, xcf2png, which works only on linux and unix-like systems.
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.
Created attachment 5944 [details] 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.
Could you please attach the patch separately from anything else? Otherwise, we cannot view it on bugzilla.
Created attachment 5945 [details] the patch
Created attachment 5946 [details] python script to interact with pixbuf loader
Created attachment 5954 [details] adding a missing line Adding a missing line wasn't in the first patch.
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
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.
Comment on attachment 5946 [details] 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)
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.
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. :)
Created attachment 9764 [details] 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
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
identify was replaced with a 100% PHP implementation with r108141. Should we consider this bug as fixed ? :)
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.
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.
Looks fine to me?
(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.
(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.
(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 )
(In reply to comment #21) > Thumbnailing should really be improved. This issue is tracked on Bug 35622