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
I end up with memory faults using Wand.
I'm sure its the .sequence part. If I remove that, its fine. I've read all I can find on sequence, how its an Image vs SingleImage.
The SingleImage sequence part stays in memory. I've tried to use the following:
main.sequence[0].destroy()
but it does not get rid of the image in the memory.
I'm processing thousands of files, but after just a few dozen I get segmentation faults.
I'm pretty sure its closing the 'main' Image. Just not the main.sequence SingleImage.
Is there a way to forcibly close that?
I should say I've also tried this
with Image(image=img.sequence[0]) as main:
thinking the With statement would close it indirectly. But it does not.
Can anyone help?