Running the following code primarily using the Wand library, "base" is an image loaded under the Image() context, and "font_path" is a path to a .ttf file:

        with Drawing() as context:
            context.stroke_width = 4
            context.stroke_color = Color('black')
            context.fill_color = 'None'
            context(base)
        base.caption(text, left=bcs[best_cand][0], top=bcs[best_cand][1], width=int(bcs[best_cand][2]-bcs[best_cand][0]), height=int(bcs[best_cand][3]-bcs[best_cand][1]), font=Font(font_path, color=Color('white')), gravity='center')
        base.save(filename='./testing_optimality.png')

And getting the following exception at the base.caption() line: File "/usr/local/lib/python3.8/site-packages/wand/image.py", line 10142, in read raise WandRuntimeError(msg) wand.exceptions.WandRuntimeError: MagickReadImage returns false, but did not raise ImageMagick exception. This can occur when a delegate is missing, or returns EXIT_SUCCESS without generating a raster.

The code works properly on my local machine but not on Docker. I tried installing Ghostscript, I tried using both the latest Imagemagick as well as Imagemagick-6.q16. Furthermore I tried editing the policy.xml docs in the Docker image with the following command:

mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xml.off

My code was working perfectly about two weeks ago. I opened it up again today and it's been like this. I'm very desperate for a solution. Thanks!!

0

There are 0 best solutions below