You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
56 lines
1.2 KiB
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <wand/MagickWand.h>
|
|
|
|
int main(int argc,char **argv)
|
|
{
|
|
#define ThrowWandException(wand) \
|
|
{ \
|
|
char \
|
|
*description; \
|
|
\
|
|
ExceptionType \
|
|
severity; \
|
|
\
|
|
description=MagickGetException(wand,&severity); \
|
|
(void) fprintf(stderr,"%s %s %lu %s\n",GetMagickModule(),description); \
|
|
description=(char *) MagickRelinquishMemory(description); \
|
|
exit(-1); \
|
|
}
|
|
|
|
MagickBooleanType
|
|
status;
|
|
|
|
MagickWand
|
|
*magick_wand;
|
|
|
|
if (argc != 3)
|
|
{
|
|
(void) fprintf(stdout,"Usage: %s image thumbnail\n",argv[0]);
|
|
exit(0);
|
|
}
|
|
/*
|
|
Read an image.
|
|
*/
|
|
MagickWandGenesis();
|
|
magick_wand=NewMagickWand();
|
|
status=MagickReadImage(magick_wand,argv[1]);
|
|
if (status == MagickFalse)
|
|
ThrowWandException(magick_wand);
|
|
/*
|
|
Turn the images into a thumbnail sequence.
|
|
*/
|
|
MagickResetIterator(magick_wand);
|
|
while (MagickNextImage(magick_wand) != MagickFalse)
|
|
MagickResizeImage(magick_wand,106,80,LanczosFilter,1.0);
|
|
/*
|
|
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);
|
|
}
|