Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <magick/MagickCore.h>
#include <windows.h>
void main(int argc, char *argv[])
{
ExceptionInfo *exception;
Image *image, *images, *resize_image;
ImageInfo *image_info;
char BUF[256];
int j;
for (j=1; j<65; j++) {
sprintf(BUF, "001-%03d.jpg", j);
OutputDebugString(BUF);
MagickCoreGenesis(argv[1], MagickTrue);
image_info = CloneImageInfo((ImageInfo *) NULL);
exception = AcquireExceptionInfo();
(void) strcpy(image_info->filename, BUF);
images = ReadImage(image_info, exception);
images = CoalesceImages(images, exception);
image = GetImageFromList(images, 0);
resize_image = ResizeImage(image,640,480,LanczosFilter,1.0,exception);
// Write the image thumbnail
(void) strcpy(resize_image->filename, "thumbnail.JPG");
WriteImage(image_info, resize_image);
DestroyImage(image);
DestroyImage(resize_image);
DestroyImageInfo(image_info);
DestroyExceptionInfo(exception);
MagickCoreTerminus();
}
}