Imdecode crashing

Thank you very much @berak, the problem was that I was giving imdecode a wrong image format. Right now, I’ve been able to receive 2000+ images without crashing when the largest amount of images previously didn’t reach 200.

I liked your last reply as I don’t know if there’s another way of marking a reply as the answer.

Again, many thanks for your help!