Wand Can't Open Temporary File When Creating GIF [Python]

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Saineolaí
Posts: 2
Joined: 2018-03-18T07:57:56-07:00
Authentication code: 1152

Wand Can't Open Temporary File When Creating GIF [Python]

Post by Saineolaí »

Hello all. I'm an ImageMagick newbie, and I've been trying to solve this issue for the past couple of days with no joy.

Using Python, I'm generating several dozen svg images and attempting to append them as frames in a gif, using a for loop to sequence.append each image in my directory. The code is generating the images themselves with no problems, but once it gets to the appending, it spits out this error.

Code: Select all

wand.exceptions.BlobError: unable to open image `/tmp/magick-xxxxxxxxxxxxxxxx': No such file or directory @ error/blob.c/OpenBlob/2712
Exception TypeError: TypeError("object of type 'NoneType' has no len()",) in <bound method Image.__del__ of <wand.image.Image: (empty)>> ignored
I'm running on Ubuntu on Windows 10.

Many thanks in advance for any advice!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wand Can't Open Temporary File When Creating GIF [Python]

Post by snibgo »

I don't use IM with Python so probably can't help. For those that can, it would help if you said what version of IM you use, and if you post a minimal script that shows the problem.

Fairly obviously, check that /tmp has enough free space.
snibgo's IM pages: im.snibgo.com
Saineolaí
Posts: 2
Joined: 2018-03-18T07:57:56-07:00
Authentication code: 1152

Re: Wand Can't Open Temporary File When Creating GIF [Python]

Post by Saineolaí »

IM version - 8:6.8.9.9-7ubuntu5.9

Just to be safe, I ran df -h /tmp like you suggested, and there's still gigs of space!

Here's my code:

Code: Select all

images = glob.glob(os.path.join(source_dir, '*.svg'))
with Image(filename=images[0]) as img:
    for the_file in images[1:]:
        with Image(filename=the_file) as frame:
            img.sequence.append(frame)
    img.save(filename=target_fn)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wand Can't Open Temporary File When Creating GIF [Python]

Post by snibgo »

How many pixels are there in total? You can probably print the width and height of each image, and even calculate the total number of pixels. (But that will only work for SVGs that are successfully rasterised.)

How much main memory do you have? I don't know if IM in Python does anything weird, but for those operations ordinary IM would use /tmp only if there wasn't enough main memory. So perhaps your SVGs, rasterised, are enormous.
snibgo's IM pages: im.snibgo.com
Post Reply