drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.59k stars 480 forks source link

How to load Metadata object from a exif file #389

Closed xuyao178 closed 5 years ago

xuyao178 commented 5 years ago

I have got the exif infomation from a photo and store as a file. Can I use metadata-extractor to load this file as a Metadata object? I can use command "exif -i xxx.exif" to get the infomations.

drewnoakes commented 5 years ago

I don't know what tool you've used to extract the exif segment, but assuming it's extracted a JPEG segment, you should be able to use ExifReader.readJpegSegments.

If the tool removed the preamble from the JPEG segment, you might need to use ExifReader.extract instead.

xuyao178 commented 5 years ago

@drewnoakes Thanks a lot. I used ExifReader.readJpegSegments to solve my problem.