I deleted your fake 'answer' and put it in your post. Notice how now when I try to answer, I can actually SEE your new code ?
kachura wrote:
I am making a program for a school to maintain their record. I will store some details about the student and also their pictures
So how does it make sense that the school has only ONE student ? How big is the picture ? Why did you change all of your code, EXCEPT the line that loads ALL the pictures and not just a specific one ?
It would also help if you told us what line gets the error. And, as Rob pointed out, you continue to make copy after copy of your image in memory.
I assume this is a homework assignment and not something that will be used in real life. You should perhaps talk to your teacher at this point.