I'm a bit confused here; is this your actual/current code?
Because if so, you're filtering out your saved images by only looking at those with the file extension .png, whereas when you save them to disk, you are saving them with no extension at all, just a UUID as the filename.