For Context: Without getting too detailed, I am basically creating a program where it takes random images, recolors them, and puts them together through alpha_compositing. The file paths for each image are stored in various nested dictionaries. Once each image is complete, it is saved to a folder with the image's name being a code made up of dictionary keys that, if put back into the program, can recreate the image.
The issue: I have the program set up with a value I can change to determine how many images the program puts together in one go. However, I have noticed that if I create images in batches, it seems to layer unnecessary images not listed in the composite image's final code-name. If I input the code back into the program, the image is recreated as it should. When I have the program create images one by one, it seems the issue doesn't occur. I have a strong feeling this could be some weird data buffer issue like the buffer needs to be cleared or something.
Does anyone have any advice on how to deal with this issue? I don't know what could I could show to help as I don't know what/if anything in my code is causing the issue. Would be grateful to hear your thoughts.