Hello there @mikael !
I see what your saying but what you cannot see is originally (and before i fixed the duplicate streams) i had somthing similar to this:
img = Image.open('my_image.png')
img.load()
img_rs = img.resize((256, 256), 1)
with io.BytesIO() as iodata:
img_rs.save(iodata, 'png')
texture=scene.Texture(ui.Image.from_data(iodata.getvalue(), ...
...
i changed it to img=img... to reduce code knowing ill never need that exact ref to original again during this loop session.reason is i place the Texture object in a cache dict and from here on is called from there 🤓🤓
##EDIT
@mikael
I also forgot to include my finally block that handles any mishaps once caching is complete..
finally:
iodata.close()
f.close()
img.close()
del img
del f
del iodata
for x in locals():
print(x)