|
|
发表于 2005-12-5 17:28:59
|
显示全部楼层
没有,慢慢看吧,偶的英文也很烂的说
这是偶的一个例子:
[PHP]static int v_init_flag;
void v_init(void)
{
MagickWandGenesis();
v_init_flag = 1;
}
void v_fini(void)
{
MagickWandTerminus();
v_init_flag = 0;
}
/**
* save frame pixbuf to file
* the file format is detected from by @fname's extension.
*/
void v_save_frame(
const uint8_t* pixbuf,
int src_width,
int src_height,
const char* fname,
double rotate_degree,
int dst_width,
int dst_height)
{
MagickWand* magick_wand;
MagickBooleanType status;
PixelWand* background;
if(!v_init_flag)
v_init();
magick_wand = NewMagickWand();
/**
* set background
*/
background = NewPixelWand();
PixelSetColor(background, "#000000");
/**
* consititute an image from pixbuf
* pixbuf shouble be arbitary "RGB" with 8bit each pixel format.
*/
status = MagickConstituteImage(magick_wand, src_width, src_height, "RGB", CharPixel, pixbuf);
assert(status);
/**
* Turn the images into a thumbnail sequence.
*/
MagickResetIterator(magick_wand);
while (MagickNextImage(magick_wand) != MagickFalse){
if(rotate_degree > 0.5 ||
rotate_degree < -0.5)
MagickRotateImage(magick_wand, background, rotate_degree);
MagickResizeImage(magick_wand,dst_width,dst_height,LanczosFilter,1.0);
MagickSetImageCompressionQuality(magick_wand, 75);
}
status=MagickWriteImages(magick_wand,fname,MagickTrue);
assert(status);
DestroyPixelWand(background);
DestroyMagickWand(magick_wand);
}[/PHP] |
|