Page 1 of 1

MagickSeparateImageChannel

Posted: 2014-08-06T03:02:52-07:00
by jeje35
Hi, I'm trying to convert a simple command line SR.png -channel RGBA -separate SR_%d.png to a MagickWand program.

Here's my code:

Code: Select all

   mw_logo = NewMagickWand();
   status = MagickReadImage(mw_logo, argv[2]);      // read logo
   if (status == MagickFalse)
     ThrowWandException(mw_logo);

   mw_r = CloneMagickWand(mw_logo);
   mw_g = CloneMagickWand(mw_logo);
   mw_b = CloneMagickWand(mw_logo);
   mw_a = CloneMagickWand(mw_logo);

   MagickSeparateImageChannel(mw_r, RedChannel);
   MagickSeparateImageChannel(mw_g, GreenChannel);
   MagickSeparateImageChannel(mw_b, BlueChannel);
   MagickSeparateImageChannel(mw_a, AlphaChannel);

   MagickWriteImage(mw_r, "/tmp/SRr.png");
   MagickWriteImage(mw_g, "/tmp/SRg.png");
   MagickWriteImage(mw_b, "/tmp/SRb.png");
   MagickWriteImage(mw_a, "/tmp/SRa.png");
When I compare the output files from the command line to the MagickWand program, I can see they are different. I guess I miss something but I can't figure out what.
Thanks for helping!