I have the code from this example which is how it's supposed to work for all formats. It works great for png but not for jpg or bmp (gif does not have this setting).
I tried this code but it throws on
Element jfif = (Element)tree.getElementsByTagName("app0JFIF").item(0);
Any idea how to do this?