how to call MagickVignetteImage ?

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
hytgbn

how to call MagickVignetteImage ?

Post by hytgbn »

I'm looking for vignette effects like adobe photoshop.

I found MagickVignetteImage function, which have 4 arguments.

But It always give me eclipsed image with white border.

I want to get black vignetted image.

How can I call MagickVignette image ? or FxImage?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to call MagickVignetteImage ?

Post by fmw42 »

set the background color
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: how to call MagickVignetteImage ?

Post by el_supremo »

Try incorporating this code segment into your program:

Code: Select all

	MagickWand *m_wand = NULL;
	PixelWand *p_wand = NULL;
	long w,h;

	MagickWandGenesis();

	m_wand = NewMagickWand();

        // Change the filename here
	MagickReadImage(m_wand,"chsp.jpg");

	w = MagickGetImageWidth(m_wand);
	h = MagickGetImageHeight(m_wand);

	p_wand = NewPixelWand();
	PixelSetColor(p_wand,"black");
	MagickSetImageBackgroundColor(m_wand,p_wand);
	MagickVignetteImage(m_wand,0,175,(long)(w*.05),(long)(h*.05));
The default background colour is white but you can change it as shown above.
You'll have to play with the size of the ellipse and the black and white points to get the effect you want.

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.
hytgbn

Re: how to call MagickVignetteImage ?

Post by hytgbn »

el_supremo // Thank you so much :)

Now I can change background color. :)

but I have one more question..


What do black point and white point mean?

I changed them but the result isn't change at all.


Image

this is the result image, it doesn't have alpha effect.

So... what do I have to check?

magick wand is created by function MagickConstituteImage

MagickConstituteImage(magick_wand, width, height, "ARGB", CharPixel, bytes);
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: how to call MagickVignetteImage ?

Post by el_supremo »

hytgbn wrote:What do black point and white point mean?
I haven't figured out exactly what their effect is on the image.
this is the result image, it doesn't have alpha effect.
Your image doesn't show up at all and I also can't download it.

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.
hytgbn

Re: how to call MagickVignetteImage ?

Post by hytgbn »

oops I'm sorry

this is url of image . http://www.twitpic.com/1aflvq

it doesn't effect by black point and white point arguments.
AidenMontgomery
Posts: 1
Joined: 2011-10-27T02:57:31-07:00
Authentication code: 8675308

Re: how to call MagickVignetteImage ?

Post by AidenMontgomery »

I know this is an old thread, but for anyone else finding it whilst searching.
el_supremo wrote:
hytgbn wrote:What do black point and white point mean?
I haven't figured out exactly what their effect is on the image.
this is the result image, it doesn't have alpha effect.
What I have figured out is that the black and white point values affect the feathering of the vignette effect.
So black = 0 and white = 255 gives a nice feathered/blended look, whereas black = 0 and white = 0 gives no feathering.

The following code gives me a nice blended vignette effect.

Code: Select all

   MagickWand *m_wand = NULL;
   PixelWand *p_wand = NULL;
   long w,h;

   MagickWandGenesis();

   m_wand = NewMagickWand();

        // Change the filename here
   MagickReadImage(m_wand,"chsp.jpg");

   w = MagickGetImageWidth(m_wand);
   h = MagickGetImageHeight(m_wand);

   p_wand = NewPixelWand();
   PixelSetColor(p_wand,"black");
   MagickSetImageBackgroundColor(m_wand,p_wand);
   MagickVignetteImage(m_wand,0,255,(long)(w*.05),(long)(h*.05));
Post Reply