Comfy-Org / Comfy-Org/ComfyUI

close image file after loading?

Open
#3,477 3 comments 0 reactions 0 assignees View on GitHub
Bug Feature
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

The "Load Image" node opens an image file here:
https://github.com/comfyanonymous/ComfyUI/blob/2de3b69b3074028fd0f850f801f4ca023489c692/nodes.py#L1460

and I think we should close it using `img.close()` before leaving the function.

This will release the handle of the file and allow other processes to access the image file. It's not critical but it feels better to do it, right?

P.S. I noticed this while trying to delete the image file in a later node. But this is not related to the issue since I have created special ImageLoader as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.