Last modified: 2014-08-05 20:02:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37622, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35622 - ImageMagick: Properly set alpha channel values for XCF Thumbnail
ImageMagick: Properly set alpha channel values for XCF Thumbnail
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Bawolff (Brian Wolff)
: upstream
Depends on: ubuntu-trusty 17959
Blocks: multimedia
  Show dependency treegraph
 
Reported: 2012-03-30 20:42 UTC by Mark A. Hershberger
Modified: 2014-08-05 20:02 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
short gimp script to open an xcf file, merge visible layers, resize, save as a png (594 bytes, text/x-scheme)
2012-03-31 01:22 UTC, Bawolff (Brian Wolff)
Details

Description Mark A. Hershberger 2012-03-30 20:42:41 UTC
This is an upstream bug.  I'm just marking it here so people who are interested can keep track of it.

Compare the following two images:

https://commons.wikimedia.org/wiki/File:%22What_a_Brilliant_Idea!%22_Barnstar.png

https://commons.wikimedia.org/wiki/File:%22What_a_Brilliant_Idea!%22_Barnstar.xcf

The first is very close to the PNG that Gimp produces from the XCF file.  Thumbnails on the XCF file page should look like the PNG upload's file page.
Comment 2 Bawolff (Brian Wolff) 2012-03-31 01:22:26 UTC
Created attachment 10353 [details]
short gimp script to open an xcf file, merge visible layers, resize, save as a png

I think over the long term we should look at using gimp directly. xcf is gimps internal format, and as such its really complicated, so its not surprising that image magick only has cursory support for it. After all imagemagick is more concerned with manipulating formats link png, jpg, etc that are meant for general use.


Gimp can be used to scale images with the following command (not sure how efficient this is. Yes I know the command line is scary)

gimp -d -i -b '( (lambda ( filename width height ) (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image))) (finalfilename (string-append filename ".png")))(gimp-image-merge-visible-layers image CLIP-TO-IMAGE)(set! drawable (car (gimp-image-get-active-layer image)))(gimp-image-scale-full image width height INTERPOLATION-CUBIC)(gimp-file-save RUN-NONINTERACTIVE image drawable finalfilename finalfilename)(gimp-image-delete image))) "/path/to/image.xcf" 320 240 ) (gimp-quit 0)' > /dev/null

Which would scale the /path/to/image.xcf to 320x240 pixels (The filename, width and height come at end).

I'm attaching a scheme file version of the above command with better spacing. Its possible to have it in a separate file and avoid the insane command line, but i think that's probably not ideal for mediawiki's use case. Anyhow see the docs at http://www.gimp.org/tutorials/Basic_Batch/
Comment 3 Mark A. Hershberger 2012-04-01 16:51:53 UTC
Looks like the ImageMagick peeps have a patch!
w00!

http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=20642#p82784
Comment 4 Derk-Jan Hartman 2012-04-01 17:17:02 UTC
Awesome, good work on reaching out Mark !
Comment 5 Derk-Jan Hartman 2012-04-27 12:29:28 UTC
"I can confirm that that specific XCF file is now 'flattening' correctly.

Just be sure that you do not set a global -compose setting before the -flatten operation, as this will likely override individual layer image compose settings."

Seems fixed upstream.
Comment 6 Marco 2012-06-13 11:26:52 UTC
(In reply to comment #3)
> Looks like the ImageMagick peeps have a patch!
> w00!
> 
> http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=20642#p82784

Thanks. How long does it usually take until the changes get visible on commons?
Comment 7 Sam Reed (reedy) 2012-06-13 11:28:54 UTC
(In reply to comment #6)
> (In reply to comment #3)
> > Looks like the ImageMagick peeps have a patch!
> > w00!
> > 
> > http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=20642#p82784
> 
> Thanks. How long does it usually take until the changes get visible on commons?

imagemagick needs rebuilding and pushing. Depending on when this made it into the  ubuntu apt repositories, it may mean that with the upgrade of the image scalers to 12.04, the benefit will come in
Comment 8 Sam Reed (reedy) 2012-06-13 11:32:10 UTC
We look to repackage this ourselves, so I'm not sure if we'll go to the default package..

Currently:
reedy@srv219:~$ convert --version
Version: ImageMagick 6.6.2-6 2011-03-09 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features:

http://packages.ubuntu.com/search?keywords=imagemagick&searchon=names&suite=lucid&section=all

lucid (graphics): image manipulation programs 
7:6.5.7.8-1ubuntu1.2 [security]: amd64 i386 

http://packages.ubuntu.com/search?keywords=imagemagick&searchon=names&suite=precise&section=all

precise (graphics): image manipulation programs 
8:6.6.9.7-5ubuntu3.1 [security]: amd64 i386
Comment 9 Marco 2012-09-23 10:55:46 UTC
imagemagick seems to have problems with indexed .xcf files. See this thumb: https://upload.wikimedia.org/wikipedia/commons/thumb/archive/4/40/20120923105304!Crimea-no.xcf/120px-Crimea-no.xcf.png (thumb of https://commons.wikimedia.org/wiki/File:Crimea-no.xcf )
Comment 10 Bawolff (Brian Wolff) 2014-07-04 03:42:01 UTC
(In reply to Marco from comment #9)
> imagemagick seems to have problems with indexed .xcf files. See this thumb:
> https://upload.wikimedia.org/wikipedia/commons/thumb/archive/4/40/
> 20120923105304!Crimea-no.xcf/120px-Crimea-no.xcf.png (thumb of
> https://commons.wikimedia.org/wiki/File:Crimea-no.xcf )

Looks like it doesn't support them at all. In gerrit change https://gerrit.wikimedia.org/r/#/c/144115/ I told MW to just give up on indexed files, and display a generic icon on the file description page ([[File:Xcf.png]] as of https://gerrit.wikimedia.org/r/#/c/144116/ )
Comment 11 Gerrit Notification Bot 2014-07-04 05:04:28 UTC
Change 144118 had a related patch set uploaded by Brian Wolff:
Fix alpha transparency in XCF images

https://gerrit.wikimedia.org/r/144118
Comment 12 Bawolff (Brian Wolff) 2014-07-04 05:08:49 UTC
(In reply to Gerrit Notification Bot from comment #11)
> Change 144118 had a related patch set uploaded by Brian Wolff:
> Fix alpha transparency in XCF images
> 
> https://gerrit.wikimedia.org/r/144118

This was in the title of the bug, but alpha channel isn't mentioned elsewhere in this bug. (Although image magick developers do mention it at http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=20642#p82834 , which I only discovered after I figured it out for myself).

I'm unclear what else is to be done for this bug. Most of this is an upstream issue (e.g. Indexed xcf file support is going to depend on image magick implementing that). It might be a cool enhancement request to allow gimp rendering of xcf files, for third parties, even if WMF doesn't want to use that.

So to be clear, can someone summarize if there is more to be done here?
Comment 13 Gerrit Notification Bot 2014-07-08 14:40:54 UTC
Change 144118 merged by jenkins-bot:
Fix alpha transparency in XCF images

https://gerrit.wikimedia.org/r/144118
Comment 14 Marco 2014-07-20 10:47:52 UTC
(In reply to Bawolff (Brian Wolff) from comment #12)
> So to be clear, can someone summarize if there is more to be done here?

I don't think so, as you already uploaded all patches. Though, we need to wait for bug 63899 (ubuntu-trusty) to be fixed.
Comment 15 Bawolff (Brian Wolff) 2014-07-20 14:33:49 UTC
Hmm. newer image magick doesn't seem to like having the -thumbnail widthxheight! line before the layer merge part. Seem to interpret that as make all the layers precisely widthxheight.
Comment 16 Gerrit Notification Bot 2014-07-20 14:51:14 UTC
Change 147909 had a related patch set uploaded by Brian Wolff:
For xcf files, compose layers before scaling

https://gerrit.wikimedia.org/r/147909
Comment 17 Gerrit Notification Bot 2014-07-21 12:30:03 UTC
Change 147909 merged by jenkins-bot:
For xcf files, compose layers before scaling

https://gerrit.wikimedia.org/r/147909
Comment 18 Tomasz W. Kozlowski 2014-08-05 20:02:28 UTC
Both patches have been merged, assuming bug is fixed.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links