MagickBooleanType
status;
MagickWand
*magick_wand;
if (argc != 3)
{
(void) fprintf(stdout,"Usage: %s image thumbnail\n",argv[0]);
exit(0);
}
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand,argv[1]);
if (status == MagickFalse)
ThrowWandException(magick_wand);
DrawingWand *dwand=NewDrawingWand();
AffineMatrix affine;
affine.sx=2.0;
affine.rx=1.1,
affine.ry=1.1;
affine.sy=2.0;
affine.tx=-100.0;
affine.ty=-200.0;
AffineMatrix *aff=&affine;
DrawAffine(dwand,aff);
MagickBooleanType sta_trans=MagickAffineTransformImage(magick_wand,dwand);
MagickDrawImage(magick_wand,dwand);
DrawRender(dwand);
if(sta_trans==MagickFalse) ThrowWandException(magick_wand);
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand,argv[2],MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return(0);
**********************
the out put image have not did affine .who can tell me why?
and Is it means i need use
MagickDistortImage (MagickWand *wand, const DistortImageMethod method, const unsigned long number_arguments, const double *arguments, const MagickBooleanType bestfit)
this function to do affineTransform.and my imageImagick vision is 6.4.6.1 install on RedHat as 4
why after MagickAffineTransformImage called but no effect
why after MagickAffineTransformImage called but no effect
Last edited by smileface on 2008-11-29T23:52:24-07:00, edited 1 time in total.
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: why after MagickAffineTransformImage called but no effect
I can't get affine to work either on IM 6.4.4 (Win XP)
This code just outputs an unmodified logo: image.
Pete
This code just outputs an unmodified logo: image.
Code: Select all
#include <windows.h>
#include <wand/magick_wand.h>
#define _USE_MATH_DEFINES
#include <math.h>
#define ThrowWandException(x) MessageBox(NULL,"ERK","",MB_OK);
void test_wand(void) {
MagickBooleanType status;
MagickBooleanType sta_trans;
MagickWand *magick_wand;
DrawingWand *dwand;
AffineMatrix affine;
AffineMatrix *aff=&affine;
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand,"logo:");
if (status == MagickFalse)ThrowWandException(magick_wand);
// translate and scale - no rotation
affine.sx=.5;
affine.rx=0;
affine.ry=0;
affine.sy=.5;
affine.tx=-50;
affine.ty=50;
dwand = NewDrawingWand();
DrawAffine(dwand,aff);
sta_trans=MagickAffineTransformImage(magick_wand,dwand);
// This should be before MagickDrawImage but neither should be needed
// They don't do anything here anyway
// DrawRender(dwand);
// MagickDrawImage(magick_wand,dwand);
if (sta_trans==MagickFalse) ThrowWandException(magick_wand);
// MagickResetImagePage(magick_wand,"");
/*
Write the image then destroy it.
*/
status=MagickWriteImage(magick_wand,"logo_affine.png");
if (status == MagickFalse)ThrowWandException(magick_wand);
magick_wand = DestroyMagickWand(magick_wand);
dwand = DestroyDrawingWand(dwand);
MagickWandTerminus();
// return(0);
}
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.
See my message in this topic for a link to a zip of all the files.
I have found a solution to solve this problem
I have show the way in my blog.
If someone have met the same problem,u may just try to use this way to do the affine distortion.
this is the url:
http://blog.csdn.net/xmr_gxcfe/archive/ ... 58913.aspx
If u have other advices please tell me.Thanks:)
If someone have met the same problem,u may just try to use this way to do the affine distortion.
this is the url:
http://blog.csdn.net/xmr_gxcfe/archive/ ... 58913.aspx
If u have other advices please tell me.Thanks:)