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

readMetadata(inputStream) : Need to stop stream when a image EXIF detected. #397

Open doopedia opened 5 years ago

doopedia commented 5 years ago

To fetch exif from a image on another domain, you have to download the whole image.

For a exif, we only need a first few(?) bytes, so I hope there will a feature that read first few streams and stop it when exif is fetched. I know exif is not always in the head of file. But I believe it worths try.

https://stackoverflow.com/questions/13861581/get-exif-data-without-downloading-whole-image-python There's some else with same interest.

In a public cloud, the object storage(AWS S3, Azure Blob ...) is much cheaper so you have to use it. But they serve files as different domain. So this feature is very needed.

drewnoakes commented 5 years ago

Agree completely, and that's the intent. IIRC there's some code that attempts to validate an offset is within range, which then tries to get the length of the stream in order to compare against it. In order to get the length it buffers the whole image in memory (which brings other problems too). This process could be smarter (for example, only reading until the offset)

vicmosin commented 4 years ago

Any steps were made regarding the issue?