-
Notifications
You must be signed in to change notification settings - Fork 618
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
Support EXIF #1045
Comments
👍 I think the way to do this would be to implement this first for a single format, directly on the encoder/decoder and then if we can find a clean/general API extend it to more formats. |
Seems like a problem similar to |
There is a few packages providing exif info currently. I use kamadak-exif in a project and is quite happy with that. But yes, better integration with the image echosystem would probably be nice. |
You may be interested in image-rs/image-png#116 |
This is also neccessary for correctly orienting JPEGs. It could be argued that orientation correction should be automatically applied to the pixel buffer, making it even more important to integrate this functionality rather than pointing to other crates 🙂 |
I recently got a feature request that would require image-rs to support writing EXIF data: So, 👍 on this ! |
One year later (!) but this would be great. I'm saving images using image and would like to add some basic metadata to them, but there's no good way to do it! Strangely, currently, there's no good create for writing EXIF data for Rust. There's a bunch of crates to read metadata; a few wrappers for some C libraries (ugh); and a bunch of really old crates of dubious effectiveness. BA pure Rust EXIF writer is nowhere to be found. I could see this being a separate crate just for EXIF writing (depending on format) and then exposed somehow so Image can make use of it when writing images to disk. |
You should be able to do so with the help of kamadak-exif to encode the EXIF data and img-parts (I'm the author of it) to write it to an existing image. See also kamadak/exif-rs#1 |
Thanks for the tip. I hadn't ran into img-parts before when trying to find libraries for my use case. I managed to add metadata writing to a project of mine using img-parts and it seems to be working well. A bit suboptimal since it writes the file, reads it, and writes it again with metadata, but it's "good enough" for now. After implementing this feature and doing some research on the problem space I think it might actually not be a good idea for In fact, I wonder if it makes sense for (Note: I'm not an advanced Rust programmer, so I might be missing a better solution for my use case.) |
The |
Ah, I see. I was using |
I'd also appreciate this (mainly to preserve image orientation/rotation). My workaround: What I now did instead: I use |
I'm using your approach and I'm wondering how to read the EXIF data without having to clone the image buffer. Since loading the buffer as an image moves the value. Any thoughts? Thanks. |
Ok, since my input is a buffer, I can read EXIF data without modifying the buffer like this: // input: image_buffer: &[u8]
let exif_reader = exif::Reader::new();
let exif = exif_reader.read_raw(image_buffer.to_vec()); Update: Oh, just figured that this is actually cloning the buffer... :-/ |
I am doing something similar with // input: image_buffer: &[u8]
exif::Reader::new().read_from_container(&mut std::io::Cursor::new(image_buffer)) |
AFAIK is also creating a copy of the buffer. |
Writing a ImageDescription into an existing JPG file. I already tested this with kamadak-exif, but when just doing so the file seems to feature no image any more :( |
I would like to be able to read and write EXIF meta data, especially for PNG and JPEG.
My specific use case for this functionality is
a) storing/loading configuration within/from screenshots for reproducibility,
b) maintaining metadata when processing images.
If there is interest I would be very willing to implement this - hints and feedback welcome :)
The text was updated successfully, but these errors were encountered: