This content has been marked as final. Show 4 replies
You'll need to post a link to the jpeg in question.
Besides that, I have another question. Could we get one or two specific metadata from a jpeg file without load whole file into the memory. For example, I only want the location information in a photo which are took by my iphone.You have to load all of the metadata. This isn't the whole file, only the first few KB or so of it.
Ok [test photo|http://www.panoramio.com/photo/44952561]
the link is the photo .
It will cause exception when i read the meatadata.
Still,I'm not sure about how to load metadata without loading the whole file.
Irfan View's EXIF viewer does not show any EXIF metadata from that image.
Some points should help.
1. There are two types of meta data available from after reading, or before writing with an image.
a. stream meta data
b. Image meta data
2. you need to read the image completely first with the java.imageio.ImageReader of which you can choose to read only image-index number "0" (that is the main image) . ( and generally there are no extra index of images - "no thumbnails").
3. You can obtain the Image meta data better from the returned IIOImage object, but finally you will need to be good at making iteration loops to use the getTree() method to obtain the XML "org.w3c.dom.Node" that contais the meta data, that has been formatted by the java API.
4. About the "JFIF" name in .jpeg and .jpg streams , it does not like that "format name" on the stream and throws an error , i haven't used the newer JAI classes at this time that use Tiff format and JPEG 2000 format.
Only .tiff .jpeg .jpg extensions in java can have EXIF data , "stream data is independent of" EXIF and GPS info, and is with the image type/format spec.
note .jfif is an extension sometimes found on jpeg and jpg types and heavily realted compressor specs that carry non stream meta data.
Edited by: 893871 on 30/10/2011 11:34
Edited by: EJP on 31/10/2011 09:25: thanks for your answer although you're a year late. Removed your question which should be asked in a new thread. Nobody will see it here and in any case reviving old threads with new questions is considered bad form. Locking this thread.