MagickSeparateImageChannel

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
jeje35
Posts: 2
Joined: 2014-08-06T02:55:20-07:00
Authentication code: 6789

MagickSeparateImageChannel

Post 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!
Post Reply