Loading large amount of image files

I have made an image viewer unfortunately it isn’t really efficient. I can only load a maximum of around 60 medium resolution images, anything high rez or in larger volumes and the program suffers from memory errors.

My question is what is the best approach for this situation and how is it normally handled in image viewer which can at the very least open folders with 100+ files and provide thumbnails.

For clarification, the method I was using was simply loadImages(), then saving the loaded image into an array then resizing said image and saving that for the thumbnail. However as I said not very efficient.

1 Like

If Java can’t allocate that much RAM don’t load everything at once!

Instead collect all paths via listPaths(), then loadImage() + resize() + save() 1 by 1 inside a loop: