Page 1 of 1

Some problem in useing,please help me

Posted: 2008-11-28T01:14:17-07:00
by kimert
SOS!
When I Use The Plugin of MagickWand, can not find the realization of three-dimensional image perspective and distortion of the call-related function, please help me to solve this problem,Thanks
I need a picture of the effect like this :
Image

i am from china,my english is so poor,sorry

here is some effect in cmd mode,but with MagickWand ,how to achieve
convert building.jpg -matte -virtual-pixel transparent \
-distort Perspective \
'7,40 4,30 4,124 4,123 85,122 100,123 85,2 100,30' \
building_pers.png

Re: Some problem in useing,please help me

Posted: 2008-11-29T08:16:58-07:00
by el_supremo
I've been trying to get your perspective distort to work with a MagickWand program but without success.
I applied your perspective transformation to the built-in logo: image using the command line:

Code: Select all

convert logo: -matte -virtual-pixel transparent -distort Perspective \
			'7,40 4,30 4,124 4,123 85,122 100,123 85,2 100,30' \
			logo_d_p.png
which produces this image:
Image

My program (below) produces this image:
Image

@magick: I've tried all sorts of combinations of setting the options and imageproperties before and after the read, setting the background colour etc. and I can't get it to produce the transparent part that the command line produces. What am I missing here? (the program and command line are both using IM 6.4.4)

Pete

Code: Select all

#include <windows.h>
#include <wand/magick_wand.h>

void test_wand(void)
{
	MagickWand *mw = NULL;
	double cpoints[16] = {
		7,40, 4,30, 4,124, 4,123, 85,122, 100,123, 85,2, 100,30
	};

	MagickWandGenesis();

	mw = NewMagickWand();
	MagickReadImage(mw,"logo:");

	// -matte is the same as -alpha on
	MagickSetImageAlphaChannel(mw,SetAlphaChannel);

	MagickSetImageProperty(mw,"virtual-pixel","transparent");

	// and then apply the result to the image
	MagickDistortImage(mw,PerspectiveDistortion,
							16,(const double *)&cpoints,MagickFalse);

	MagickWriteImage(mw,"logo_distort_p.png");
	/* Clean up */
	if(mw)mw = DestroyMagickWand(mw);

	MagickWandTerminus();
}