本文整理汇总了C++中NewMagickWand函数的典型用法代码示例。如果您正苦于以下问题:C++ NewMagickWand函数的具体用法?C++ NewMagickWand怎么用?C++ NewMagickWand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMagickWand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char **argv) {
MagickWand *magick_wand_background;
MagickWand *magick_wand_foreground;
MagickWandGenesis();
magick_wand_background = NewMagickWand();
magick_wand_foreground = NewMagickWand();
MagickReadImage(magick_wand_background, "magick:logo");
MagickReadImage(magick_wand_foreground, "magick:rose");
MagickSetGravity(magick_wand_background, CenterGravity);
MagickSetGravity(magick_wand_foreground, CenterGravity);
MagickCompositeImage(
magick_wand_background,
magick_wand_foreground,
AtopCompositeOp,
0, 0
);
MagickSetFormat(magick_wand_background, "png");
MagickWriteImage(magick_wand_background, "./output/gravity.png");
MagickWandTerminus();
return 0;
}
示例2: main
int main(int argc,char **argv)
{
//creamos la imagen
MagickWand *imagen, *imagen2;
int proporcion = atoi(argv[3]);
//inicializamos la imagen
imagen = NewMagickWand();
imagen2 = NewMagickWand();
//cargamos la imagen
MagickReadImage(imagen,argv[1]);
//imagen2 = CloneMagickWand(imagen);
//llamamos a la funcion de redimension
Resize(imagen,imagen2,proporcion);
//guardamos la imagen en disco
MagickWriteImages(imagen2,argv[2],MagickTrue);
//liberamos memoria destruyendo la imagen
imagen = DestroyMagickWand(imagen2);
//terminamos ejecucion de la libreria
MagickWandTerminus();
return 0;
}
示例3: img_init
bool
img_init (img_t *im)
{
MagickWandGenesis();
if (im) {
im->screen = (void *) NewMagickWand();
im->banner = (void *) NewMagickWand();
return true;
}
return false;
}
示例4: NewMagickWand
unsigned char *get_transition_image_blob(char *file_buf, int buf_size,
size_t * thumbnail_size, img_transition_info *image_transition_info) {
unsigned char *image_data = NULL;
if (file_buf == NULL)
return NULL;
if (image_transition_info == NULL)
return NULL;
if ((0 == image_transition_info->is_rotate)
&& ('\0' == image_transition_info->transition_str[0])
&& (0 == image_transition_info->is_quality))
return NULL;
MagickBooleanType status;
MagickWand *magick_wand = NULL;
magick_wand = NewMagickWand();
status = MagickReadImageBlob(magick_wand, file_buf, buf_size);
if (status == MagickFalse) {
ThrowWandException(magick_wand);
return NULL;
}
image_data = covert_image(magick_wand, image_transition_info,
thumbnail_size);
magick_wand = DestroyMagickWand(magick_wand);
return image_data;
}
示例5: magickUnsharpMaskImage
int magickUnsharpMaskImage(const char *imageFile, const char *outputImage, double radius, double sigma, double amount, double threshold){
MagickBooleanType status;
MagickWand *magick_wand;
/*
Read an image.
*/
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand, (char *)imageFile);
if (status == MagickFalse){
ThrowWandException(magick_wand);
}
/*
Turn the images into a thumbnail sequence.
*/
// MagickResetIterator(magick_wand);
// while (MagickNextImage(magick_wand) != MagickFalse)
MagickUnsharpMaskImage(magick_wand, radius, sigma, amount, threshold);
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand, (char *)outputImage, MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return status;
}
示例6: magickCompressImage
int magickCompressImage(const char *imageFile, const char *outputImage, const char *format, int compressionType, double compressionRate){
MagickBooleanType status;
MagickWand *magick_wand;
/*
Read an image.
*/
// printf("compressionRate: %d", compressionRate);
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand, (char *)imageFile);
if (status == MagickFalse){
ThrowWandException(magick_wand);
}
/*
Turn the images into a thumbnail sequence.
*/
// MagickResetIterator(magick_wand);
// while (MagickNextImage(magick_wand) != MagickFalse){
MagickSetFormat(magick_wand, (char *)format);
MagickSetImageCompression(magick_wand, compressionType);
MagickSetImageCompressionQuality(magick_wand, compressionRate);
// }
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand, (char *)outputImage, MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return status;
}
示例7: magickChopImage
int magickChopImage(const char *imageFile, const char *outputImage, int width, int height, int xPos, int yPos){
MagickBooleanType status;
MagickWand *magick_wand;
/*
Read an image.
*/
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand, (char *)imageFile);
if (status == MagickFalse){
ThrowWandException(magick_wand);
}
/*
Turn the images into a thumbnail sequence.
*/
MagickResetIterator(magick_wand);
while (MagickNextImage(magick_wand) != MagickFalse)
MagickChopImage(magick_wand, width, height, xPos, yPos);
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand, (char *)outputImage, MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return status;
}
示例8: magickRotateImage
int magickRotateImage(const char *imageFile, const char *outputImage, double degree){
MagickBooleanType status;
MagickWand *magick_wand;
PixelWand * bg = malloc(sizeof(PixelWand *));
/*
Read an image.
*/
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand, (char *)imageFile);
if (status == MagickFalse){
ThrowWandException(magick_wand);
}
/*
Turn the images into a thumbnail sequence.
*/
MagickResetIterator(magick_wand);
while (MagickNextImage(magick_wand) != MagickFalse)
MagickRotateImage(magick_wand, bg, degree);
// MagickSetImageCompression(magick_wand, MW_JPEGCompression);
// MagickUnsharpMaskImage( magick_wand, 4.5, 4.0, 4.5, 0.02 );
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand, (char *)outputImage, MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return status;
}
示例9: magickResizeImage
int magickResizeImage(const char *imageFile, const char *outputImage, int columns, int rows, int magickFilter, double blur){
MagickBooleanType status;
MagickWand *magick_wand;
/*
Read an image.
*/
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand, (char *)imageFile);
if (status == MagickFalse){
ThrowWandException(magick_wand);
}
/*
Turn the images into a thumbnail sequence.
*/
MagickResetIterator(magick_wand);
while (MagickNextImage(magick_wand) != MagickFalse)
MagickResizeImage(magick_wand, columns, rows, LanczosFilter, blur);
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand, (char *)outputImage, MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return status;
}
示例10: magickModulateImage
int magickModulateImage(const char *imageFile, const char *outputImage, double brightness, double saturation, double hue){
MagickBooleanType status;
MagickWand *magick_wand;
/*
Read an image.
*/
MagickWandGenesis();
magick_wand=NewMagickWand();
status=MagickReadImage(magick_wand, (char *)imageFile);
if (status == MagickFalse){
ThrowWandException(magick_wand);
}
/*
Turn the images into a thumbnail sequence.
*/
MagickResetIterator(magick_wand);
while (MagickNextImage(magick_wand) != MagickFalse)
MagickModulateImage(magick_wand, brightness, saturation, hue);
/*
Write the image then destroy it.
*/
status=MagickWriteImages(magick_wand, (char *)outputImage, MagickTrue);
if (status == MagickFalse)
ThrowWandException(magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return status;
}
示例11: print_accumulator
/**
* Helper function to provide a visual interpretation of the accumulator.
*/
void print_accumulator(char* name) {
MagickWand *mw = NULL;
PixelWand **pmw = NULL;
PixelIterator *imw = NULL;
MagickWandGenesis();
unsigned long width, height;
width = _circumference;
height = _dimensions.semi_diagonal;
mw = NewMagickWand();
MagickSetSize(mw, width, height);
MagickReadImage(mw, "xc:black");
imw = NewPixelIterator(mw);
int y, x;
for (y=0; y<height; y++) {
pmw = PixelGetNextIteratorRow(imw, &width);
for (x=0; x< (long) width; x++) {
_CELL_TYPE* cell = &_accumulator[x][height-y-1];
PixelSetRed(pmw[x], 1.0/20.0 * cell->count);
}
PixelSyncIterator(imw);
}
MagickWriteImage(mw, name);
if(mw)
mw = DestroyMagickWand(mw);
MagickWandTerminus();
}
示例12: NewMagickWand
static MagickWand *iac_image_new(const iac_image_read_params_t *params)
{
MagickWand *wand = NULL;
/* Create wand */
wand = NewMagickWand();
if (!wand) {
iac_image_destroy(wand);
return NULL;
}
/* Set width and height of image */
if (MagickSetSize(wand, params->width, params->height) == MagickFalse) {
iac_image_exception(wand);
iac_image_destroy(wand);
return NULL;
}
/* Set format of image */
if (MagickSetFormat(wand, params->format) == MagickFalse) {
iac_image_exception(wand);
iac_image_destroy(wand);
return NULL;
}
/* Set color depth of image */
if (MagickSetDepth(wand, params->depth) == MagickFalse) {
iac_image_exception(wand);
iac_image_destroy(wand);
return NULL;
}
return wand;
}
示例13: barcode_to_png
int barcode_to_png (char *image_name) {
MagickWand *magick_wand;
MagickBooleanType status;
int width, height, pad, half_pad;
/* read a barcode image */
MagickWandGenesis();
magick_wand = NewMagickWand();
MagickSetResolution(magick_wand, 300, 300);
status = MagickReadImage(magick_wand, image_name);
if (status == MagickFalse) ThrowWandException(magick_wand, 1);
/* trim the image, resample it, and pad it by [10% of the long side] per side */
MagickTrimImage(magick_wand, 10);
width = MagickGetImageWidth(magick_wand);
height = MagickGetImageHeight(magick_wand);
pad = determine_padding(width, height);
half_pad = round(pad/2);
MagickExtentImage(magick_wand, width+pad, height+pad, -half_pad, -half_pad);
/* write image (a PNG version and a formatted PS version) */
status=MagickWriteImage(magick_wand, chop_path(image_name, ".png"));
if (status == MagickFalse) ThrowWandException(magick_wand, 2);
status=MagickWriteImage(magick_wand, chop_path(image_name, ".ps"));
if (status == MagickFalse) ThrowWandException(magick_wand, 2);
/* clean up */
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
return 0;
}
示例14: main
int main(int argc,char **argv) {
MagickWand *magick_wand;
MagickBooleanType status;
MagickWandGenesis();
magick_wand = NewMagickWand();
MagickSetResourceLimit(MemoryResource, 1000 * 1000);
MagickSetResourceLimit(DiskResource, 1000 * 1000);
status = MagickReadImage(magick_wand, "./images/picture-100M-6000x6000.png");
if (status == MagickFalse) {
printf("Failed to MagickReadImage");
return -1;
}
printf("This shouldn't be reached - the image is larger than the area resource.\n");
MagickSetImageFormat(magick_wand, "png");
status = MagickWriteImages(magick_wand, "./output/resource_output.png", MagickTrue);
if (status == MagickFalse) {
printf("Failed to MagickWriteImages");
return -1;
}
MagickWandTerminus();
return(0);
}
示例15: ngx_http_circle_gif_init
static ngx_int_t
ngx_http_circle_gif_init(ngx_http_circle_gif_loc_conf_t *cglcf)
{
u_int i;
MagickWand *wand;
PixelWand *bg_wand, *fg_wand;
DrawingWand *dwand;
wand = NewMagickWand();
bg_wand = NewPixelWand();
fg_wand = NewPixelWand();
dwand = NewDrawingWand();
if ((cglcf->circle_templates = malloc((1+radius2index(cglcf->max_radius, cglcf))*sizeof(unsigned char*))) == NULL ||
(cglcf->circle_sizes = malloc((1+radius2index(cglcf->max_radius, cglcf))*sizeof(size_t))) == NULL) {
perror("malloc()");
return NGX_ERROR;
}
for (i=0;i<=radius2index(cglcf->max_radius, cglcf);i++) {
cglcf->circle_templates[i] = ngx_http_circle_gif_template(cglcf->min_radius+i*cglcf->step_radius, &cglcf->circle_sizes[i],
wand, bg_wand, fg_wand, dwand);
}
DestroyMagickWand( wand );
DestroyPixelWand( fg_wand );
DestroyPixelWand( bg_wand );
DestroyDrawingWand( dwand );
return i;
}