ChatGPT has an annoying habit of not doing f.close() for images, even though you are directly modifying them in the loop So had to add that back a few times while asking it to make the code a little shorter and clearer