Page 1 of 1

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

Posted: 2018-03-18T08:13:00-07:00
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!

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

Posted: 2018-03-18T10:28:01-07:00
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.

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

Posted: 2018-03-18T12:09:15-07:00
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)

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

Posted: 2018-03-18T12:45:25-07:00
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.