Of course the test had a bug in it. This one is correct and still demonstrates the problem.

/*

Tim Hunter, [EMAIL PROTECTED]

gcc `Magick-config --cflags --cppflags` mpc.c `Magick-config -- ldflags --libs` -o mpc
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <magick/api.h>

int main(int argc,char **argv)
{
    ExceptionInfo exception;
    Image *hat, *bighat, *work;
    ImageInfo *info;
    int x;


    InitializeMagick("mpc_test");

    puts(GetMagickVersion(NULL));

    GetExceptionInfo(&exception);

    info = CloneImageInfo(NULL);
strcpy(info->filename, "/Users/timothyhunter/RMagick/doc/ex/ images/Flower_Hat.jpg");
    hat = ReadImage(info, &exception);
    if (exception.severity != UndefinedException)
    {
printf("ReadImage: %s: %s\n", exception.reason, exception.description);
        exit(1);
    }


    for(x = 0; ; x++)
    {
bighat = ResizeImage(hat, 819, 1024, LanczosFilter, 0.0, &exception);
        if (exception.severity != UndefinedException)
        {
printf("ResizeImage: %s: %s\n", exception.reason, exception.description);
            exit(1);
        }

strcpy(bighat->filename, "/Users/timothyhunter/Temporary/ Flower_Hat.mpc");
        WriteImage(info, bighat);
        if (bighat->exception.severity != UndefinedException)
        {
printf("WriteImage: %s: %s\n", bighat->exception.reason, bighat->exception.description);
            exit(1);
        }

        DestroyImage(bighat);

strcpy(info->filename, "/Users/timothyhunter/Temporary/ Flower_Hat.mpc");
        bighat = ReadImage(info, &exception);
        if (exception.severity != UndefinedException)
        {
printf("ReadImage: %s: %s\n", exception.reason, exception.description);
            exit(1);
        }

work = ResizeImage(bighat, 819, 1024, LanczosFilter, 0.0, &exception);
        if (exception.severity != UndefinedException)
        {
printf("ResizeImage: %s: %s\n", exception.reason, exception.description);
            exit(1);
        }

        DestroyImage(bighat);

strcpy(work->filename, "/Users/timothyhunter/Temporary/ Flower_Hat_work.jpg");
        WriteImage(info, work);
        if (work->exception.severity != UndefinedException)
        {
printf("ReadImage: %s: %s\n", work->exception.reason, work->exception.description);
            exit(1);
        }

        DestroyImage(work);

        printf("%d\n", x);
    }


    DestroyImageInfo(info);
    DestroyImage(bighat);
    DestroyImage(work);
    DestroyImage(hat);
    DestroyMagick();

    return 0;
}

_______________________________________________
Magick-developers mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-developers

Reply via email to