Description
We are using the class ImageUtils for our import project. One remark, there are two different ImageUtils classes in the code base.
The class itself has a memory problem. The Readers are cached in a static map. Problem with these readers is that they keep a reference to the actual byte[]. I also do not see a very good reason to cache these readers. The memory problem becomes visible with bigger files, but each type keeps a lot of memory. To give you an idea, we had a picture of 8Mb that took over 300 Mb of memory.
I am also wondering why the thumbnail method returns the byte[] of the original image if something goes wrong, why not throw an exception. The same thing for obtaining specific readers. Why return null and not an exception?
I made a fix, that made the class more readable. Beware I removed all the static stuff. Maybe you can use it for a change. Most urgent is the memory problem stuff.