[magick-users] Problem with MagickCombineImages() C API

Anthony Thyssen anthony at griffith.edu.au
Thu Aug 2 16:20:28 PDT 2007


"Felipe Maier Cruz" on  wrote...
| Hi All,
| 
| Its my first time here, Hola a todos! :D
| 
| I have a question about MagickCombineImages() on C API, y want to achieve
| this from C:
| 
| convert  separate_red.gif separate_green.gif separate_blue.gif
| -combine  rose_combined.gif [*]
| 
| [*] http://www.imagemagick.org/Usage/channels/#combine
| -
| 
| but, doing something like this ...
| ...
|   status_r =MagickReadImage(magick_wand_r, "separate_red.gif");
|   status_g =MagickReadImage(magick_wand_g, "separate_green.gif");
|   status_b =MagickReadImage(magick_wand_b, "separate_blue.gif");
|  ...
|   magick_wand = MagickCombineImages(magick_wand_r, RedChannel);
|   magick_wand = MagickCombineImages(magick_wand_g, GreenChannel);
|   magick_wand = MagickCombineImages(magick_wand_b, BlueChannel);
| ...
| 
| I only get the image but in yellow ... What im doing wrong here ??
| 
All three images must be in the same magick wand.

   status_a = MagickAddImage(magick_wand_r, magick_wand_g);
   status_a = MagickAddImage(magick_wand_r, magick_wand_b);

now you can combine them

   magick_wand = MagickCombineImages(magick_wand_r,
                     RedChannel|GreenChannel|BlueChannel)


I think the documentation is a bit out of date.

  * MagickAddImage()    docs  has 'images' instead of  'add_wand'

  * MagickCombineImages()  docs do not mention the 'channel' argument
      And the PHP version of the doc says only ONE of the channels
      can be given (which was only true for OLD versions
      of MagickSeparateImages() )


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
    Murphy said, 'Constants aren't', and Murphy was apparently one
    of the gods of this universe.           -- Rick Cook, "Wizard's bane"
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list