1

I am trying to port 2 graphics magick commands to the Gmagick php library (mind: not Imagick). The commands are:

  1. gm convert -matte -flatten image.png output.png
  2. gm convert -channel Matte -negate image.png output.png

Basically I am trying to extract the alpha channel from a transparent png into its own file and the image without alpha into another file from a php script.

I have the Imagick equivalents already but I am interested in Gmagick.

Any idea, anyone?

hakre
  • 193,403
  • 52
  • 435
  • 836
Dan Caragea
  • 1,784
  • 1
  • 19
  • 24

1 Answers1

0

You can make use of Gmagick::separateimagechannel to get the channel (get the number of the matte channel). About removing the matte channel, I have no clue, but it should be possible.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • I think it's possible by separating all channels BUT alpha. But the -negate command is not documented in the php doc...any idea how to negate a image with gmagick ? – Dan Caragea Jun 23 '11 at 17:14
  • What does the negate command do? Inverting the picture? XOR'ing it? – hakre Jun 23 '11 at 17:39
  • From gm man page: -negate replace every pixel with its complementary color The red, green, and blue intensities of an image are negated. White becomes black, yellow becomes blue, etc. – Dan Caragea Jun 23 '11 at 19:43