cimage-processingimagemagickmagickwand

Magickwand C change image color


I have a method called single_color for image. It changes the color of an image. It was working on my previous image magick version but after upgraded my version, it's not working.

ImageMagick Version

Version: ImageMagick 7.0.5-9 Q16 x86_64 2017-06-01

To achieve this I do this.

Here is my code.

#include <stdio.h>
#include <MagickWand/MagickWand.h>

int main(int argc, char const *argv[]) {

  MagickWand * wand;
  wand  = NewMagickWand();
  MagickReadImage(wand, "input.png");

  PixelWand * PW3, * PW4;

  PW3 = NewPixelWand();
  PW4 = NewPixelWand();

  PixelSetColor(PW3,"transparent");
  PixelSetColor(PW4,"#008080");
  MagickOpaquePaintImage(wand, PW3, PW4, 20.0*65535.0/100.0, MagickTrue);

  MagickWriteImage(wand, "single_color.png");
}

Solution

  • It is a bug in ImageMagick's latest version. I posted this on their forum. It might be fixed soon.

    Check this.