0

I have some MagickWand code where the MagickReadImage() fails (returns MagickFalse) on one system where it works on the other.

Now there is no exception occuring, MagickGetException() returns an empty string which means no exception if I understood the documentation correctly.

The file I want to open is there, I can open it with other tools under the same user, and the magick_wand I use is not NULL.

The code around the call is essentially this:

    // read image
    MagickBooleanType status = MagickReadImage(magick_wand, fn_selector);

    // make sure it worked
    if (status == MagickFalse)
    {
            char *description;
            ExceptionType severity;
            description=MagickGetException(magick_wand,&severity);
            fprintf(stderr,"%s %s %lu :%s: %u\n",GetMagickModule(),description,severity);
            description=(char *) MagickRelinquishMemory(description);
            fprintf(stderr, "magickwand couldn't read file %s\n", fn_selector);
            exit(1);
    }

Is there any way to find out why the function call fails? MagickReadImage() seems to call an internal function which is not easily debuggable, and I don't want to build the MagickWand library myself with added debug stuff if not absolutely necessary.

Using MagickWand version 6.8.9.9 (debian jessie)

1 Answers1

0

Turns out (after going through an strace) the PDF reading part of ImageMagick requires the ghostscript executable (/usr/bin/gs) to be installed on the system. Now when installing ImageMagick via the Debian apt package manager, ghostscript is not a dependency, only a recommend of the Magick library. Unfortunately Magick does not think it's necessary to inform you in any way that a library component is missing when the read call fails.

After installing the ghostscript package, everything works as expected.