If I do the following
for root, dirs, files in os.walk(myDir): for myFile in files: with Image(filename=myFile) as img: with Image(image=img) as main: print main.sequence[0].width
Ultimately, with memory errors, Wand is used.
I am sure this is part. If I remove it, it will be fine. I read everything that I can find in the sequence, like its image versus SingleImage.
Part of the SingleImage sequence remains in memory. I tried using the following:
main.sequence[0].destroy()
but he will not get rid of the image in memory.
I process thousands of files, but after several tens I get segmentation errors.
I am pretty sure that it covers the "main" image. Just not main.sequence SingleImage.
Is there a way to force this close?
I have to say I tried this too
with Image(image=img.sequence[0]) as main:
thinking that the With statement will close it indirectly. But this is not so.
Can anyone help?
source share