MagickWand equivalent of -channel RGBA

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
J2T
Posts: 6
Joined: 2012-12-12T05:27:11-07:00
Authentication code: 6789

MagickWand equivalent of -channel RGBA

Post by J2T » 2012-12-18T06:41:56-07:00

Hi guys,

i'm looking for the equivalent of the -channel RGBA command line option.

The reason is that i like to blur a image with transparency information. I get the same result as described here with the yellow circle with the black creeping pixels at the outline.

So how i can apply the -channel RGBA with MagickWand to fix that?

Thanks!

el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: MagickWand equivalent of -channel RGBA

Post by el_supremo » 2012-12-18T13:27:22-07:00

I think that the MagickWand equivalent is:

Code: Select all

MagickSetOption(magick_wand,"channel","RGBA")
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.

J2T
Posts: 6
Joined: 2012-12-12T05:27:11-07:00
Authentication code: 6789

Re: MagickWand equivalent of -channel RGBA

Post by J2T » 2012-12-19T06:05:01-07:00

Thanks Pete for your reply.

I call this right before MagickBlurImage() but it doesn't work as my test image still has the creeping black pixels.

J2T
Posts: 6
Joined: 2012-12-12T05:27:11-07:00
Authentication code: 6789

Re: MagickWand equivalent of -channel RGBA

Post by J2T » 2012-12-19T07:08:13-07:00

I tried to find a workaround but always get stuck. Maybe some of you can help me out with this?!

(I use c# + P/Invoke and my test image is a yellow square on a transparent background)

1.

Code: Select all

 IntPtr newWand = MagickMergeImageLayers(image, ImageLayerMethod.FlattenLayer);
MagickBlurImage(newWand, 0.0, 8.0);
with the result, that the blur is correct (because of the white color of the transparent pixels i guess) but the background is white (alpha=1/255). But i like to have a full transparent background. How can i achieve this?

2.

Code: Select all

MagickSetImageBackgroundColor(image, color);
MagickBlurImageChannel(image, ChannelType.AllChannels, 0, 8);
with this result. This is what i want. Nice blur with transparent background. The problem here is that MagickSetImageBackgroundColor() does not have any influences. So how i can change the color here? (at another point i use MagickSetImageBackgroundColor() in combination with MagickShadowImage() which works fantastic)

Thanks for any advice!

Cheers,
Florian

J2T
Posts: 6
Joined: 2012-12-12T05:27:11-07:00
Authentication code: 6789

Re: MagickWand equivalent of -channel RGBA

Post by J2T » 2012-12-19T09:08:36-07:00

Got it!

Code: Select all

MagickNewImage(coloredBG, width, height, color);
MagickBlurImageChannel(image, ChannelType.AllChannels, 0, 8);
MagickCompositeImage(coloredBG, image, CompositeOperator.CopyOpacityCompositeOp, 0, 0);

el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: MagickWand equivalent of -channel RGBA

Post by el_supremo » 2012-12-19T09:10:11-07:00

Don't know if this will work but try:

Code: Select all

MagickSetBackgroundColor(image, color);
instead of MagickSetImageBackgroundColor.

Pete
P.S. I see you've just got a solution. Try this anyway :-)
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.

J2T
Posts: 6
Joined: 2012-12-12T05:27:11-07:00
Authentication code: 6789

Re: MagickWand equivalent of -channel RGBA

Post by J2T » 2012-12-19T09:33:02-07:00

No, that doesn't work either.

Thanks for your suggestions :)

Post Reply