MagickSeparateImageChannel

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
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.

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!

PS: Sorry, I posted here first in the MagickWand forum...
Post Reply