本文整理匯總了C++中DestroyMagickWand函數的典型用法代碼示例。如果您正苦於以下問題:C++ DestroyMagickWand函數的具體用法?C++ DestroyMagickWand怎麽用?C++ DestroyMagickWand使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DestroyMagickWand函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: fuppes_transcoder_transcode_image_mem
int fuppes_transcoder_transcode_image_mem(plugin_info* plugin,
const unsigned char** inBuffer,
size_t inSize,
unsigned char** outBuffer,
size_t* outSize,
int width, int height,
int less, int greater)
{
MagickBooleanType status;
MagickWand* wand = NewMagickWand();
//printf("magickWand %d\n", 1);
status = MagickReadImageBlob(wand, *inBuffer, inSize);
if(status == MagickFalse) {
plugin->cb.log(plugin, 0, __FILE__, __LINE__,
"error reading image from buffer. size: %d", inSize);
wand = DestroyMagickWand(wand);
return -1;
}
//printf("magickWand %d\n", 2);
MagickWand* wandOut;
char geometry[123];
sprintf(&geometry, "%dx%d", width, height);
//char* geometry = "250x250";
wandOut = MagickTransformImage(wand, "", geometry);
wand = DestroyMagickWand(wand);
if(wandOut == NULL) {
return -1;
}
//printf("magickWand %d\n", 3);
//MagickBooleanType MagickSetFormat(MagickWand *wand,const char *format)
size_t length;
unsigned char* blob;
blob = MagickGetImageBlob(wandOut, &length);
*outBuffer = realloc(*outBuffer, length);
memcpy(*outBuffer, blob, length);
*outSize = length;
MagickRelinquishMemory(blob);
//printf("magickWand %d, %d\n", 4, *outSize);
//MagickRelinquishMemory(wandOut);
wandOut = DestroyMagickWand(wandOut);
return 0;
}
示例2: im_leave
void
im_leave (im_env_t *env)
{
if (NULL != env->ime_target_magick_wand)
DestroyMagickWand (env->ime_target_magick_wand);
DestroyMagickWand (env->ime_magick_wand);
if (NULL != env->ime_drawing_wand)
DestroyDrawingWand (env->ime_drawing_wand);
if (NULL != env->ime_background)
DestroyPixelWand (env->ime_background);
im_dbg_printf (("IM %p: about to leave %s()...", env, env->ime_bifname));
/* mutex_leave (im_lib_mutex); */
im_dbg_printf (("... IM %p: left\n", env));
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例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: 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;
}
示例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: 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;
}
示例10: 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();
}
示例11: iac_image_destroy
void iac_image_destroy(MagickWand *wand)
{
if (wand)
DestroyMagickWand(wand);
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: cb_image_save_cancel_clicked
G_MODULE_EXPORT void cb_image_save_cancel_clicked(GtkButton *button)
{
if(camera_params.wand_data.saving_wand)
DestroyMagickWand(camera_params.wand_data.saving_wand);
camera_params.wand_data.saving_wand=NULL;
gtk_widget_hide( camera_params.objects->imagesavedialog );
}