-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read_raw(&self, data: Vec<u8>)
should take a reference
#15
Comments
Exif fields are lazily parsed. Keeping a copy of unparsed data steam in the struct |
I understand that, but it would also be good to have an option to refer to a buffer also. Maybe both can be done? |
Ran into the same issue, and it's fatal in my case: I need to parse EXIF in uploads before saving them to disk, and copying the entire buffer (up to 50MiB in size) just to read some EXIF doesn't seem ideal. This would be a lot more palatable if I could create metadata-only copies. |
There could be two possible interfaces for shared buffers: // (1) Parses immediately, borrows nothing.
Reader::read_raw_nonlazy(..., data: &[u8]) -> Exif
// (2) Parses lazily using the borrowed buffer.
Reader::read_raw_ref<'a>(..., data: &'a [u8]) -> ExifRef<'a> If a raw Exif block is big and you want to avoid copying data, (1) will not meet the spirit of your goal, because when 50 MiB buffer is parsed immediately, @1e100 BTW, I am curious about your use cases. Are your raw Exif blocks really that large, or are you parsing TIFF data, where TIFF image data and Exif attributes are intermixed and the total size could be 50 MiB? |
I just need a few metadata fields before I save the file that's all. Files can be quite large though. It's not just the exif block - it's the entire uploaded file |
|
Thanks for the tip, but unfortunately it could be TIFF as well. Out of curiosity (and for others to find), why is it different? |
The Exif standard re-uses TIFF's tag-value format to store Exif fields. Anyway, if we have a TIFF image on memory and want to avoid copying the entire buffer, |
I like this! I have |
read_raw(&self, data: Vec<u8>)
should be taking a reference, eg:data: &[u8]
. Is there any reason not to do so here?The text was updated successfully, but these errors were encountered: