rewrite getXCFMetaData() to get ride of im identify
authorAntoine Musso <hashar@users.mediawiki.org>
Thu, 5 Jan 2012 14:48:55 +0000 (14:48 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Thu, 5 Jan 2012 14:48:55 +0000 (14:48 +0000)
commit1b82b6dc2384fe49903c480ea0a1f9427ce94e10
treee240bfc5a2cf2a9599623215e895167dbdf839c7
parent44dc09e35dc9f0e4ca8bb96a7fa394c8571a7d45
rewrite getXCFMetaData() to get ride of im identify

By reading the file header and unpacking the data, we can avoid
shelling out to imagemagick 'identify'. Save up some CPU cycles :D

An XCF is made of a canvas of a given width / height, the various
layers are applied to it which must fit in the canvas. So we just
use the canvas size :-)

I do not think we have any usage for channels count, so I have just
skip that part. I am not sure it makes any sense when the picture
can be made of several layers each using different channels count.

Bits per color is always 8 per definition. Grayscale is 0 - 255
and indexed palette is 256 colors at most.

XCF spec:
http://svn.gnome.org/viewvc/gimp/trunk/devel-docs/xcf.txt?view=markup

pack() / unpack() is familiar to perl monkeys

Fully reimplements r107351
includes/media/XCF.php