Some problem in useing,please help me

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
kimert

Some problem in useing,please help me

Post 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
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Some problem in useing,please help me

Post 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();
}
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.
Post Reply