Open floric opened 5 months ago
Hi,
getting the EXIF data itself as "raw bytes" (I assume a Vec
To conclude: Yes, getting the EXIF data itself (and performing at least some of the file-specific encoding) should be possible via little_exif after a small update. However, the other file-type specific stuff you'll have to figure out yourself.
Best, Tobi
Hi,
getting the EXIF data itself as "raw bytes" (I assume a Vec should be fine?) can be added relatively easily. However, writing this to an output stream can be a bit tricky:
* As you mentioned, what you have to write to the stream depends on the filetype, e.g. PNG has a special header, needs additional PNG-specific encoding, etc. (sidenote: PNG is, of the currently supported file types, the _worst_ to work with from a programmer's perspective) * You also have to figure out _where_ (or in case of a stream, _when_) to write the EXIF data * With some file types (e.g. WebP) you need to have the encoded EXIF data _before_ you start your output stream as you need to know the size of the resulting file to write it at the start.
To conclude: Yes, getting the EXIF data itself (and performing at least some of the file-specific encoding) should be possible via little_exif after a small update. However, the other file-type specific stuff you'll have to figure out yourself.
Best, Tobi
Hey Tobi,
thanks a lot for this comprehensive and fast response. I hope, that using img_pars::ImageEXIF
will be enough. At least there I can provide bytes (Vec<u8>
) for EXIF data as well as ICC profiles. The exporting to the different formats is done with the resulting object. I could give it a try, if providing the EXIF data as bytes is really easy for you, and see if img_parts
really handles all of the hard work mentioned by you for us.
Hi,
I've added a new function for the Metadata
called as_u8_vec
where you provide information about which image format you want to use (e.g. FileExtension::WEBP
) and get the EXIF data as a Vec<u8>
. However, as always, the PNG format is a pita to work with, so don't expect this to work on the first try. I'd be glad to help you with getting this to run with img_parts and PNGs if required, but there is the chance that this library will need an update as well due to how EXIF data is handled over there.
So, try it out with little_exif ver 0.3.0 and let me know what you think and if it works or where work is still required. And, in the likely case that you do run into problems, it would be great to get some sort of file stream as hex code or (best case) an image file you tried to create but are unable to use due to problems with the EXIF data so I can compare and debug.
Best, Tobi
Hi,
I've added a new function for the
Metadata
calledas_u8_vec
where you provide information about which image format you want to use (e.g.FileExtension::WEBP
) and get the EXIF data as aVec<u8>
. However, as always, the PNG format is a pita to work with, so don't expect this to work on the first try. I'd be glad to help you with getting this to run with img_parts and PNGs if required, but there is the chance that this library will need an update as well due to how EXIF data is handled over there.So, try it out with little_exif ver 0.3.0 and let me know what you think and if it works or where work is still required. And, in the likely case that you do run into problems, it would be great to get some sort of file stream as hex code or (best case) an image file you tried to create but are unable to use due to problems with the EXIF data so I can compare and debug.
Best, Tobi
Hey :) thanks a lot. I will definitely give it a try. In the mean time I was also successful to use kamadak/exif-rs for the same purpose. But I only tried JPEG so far. But your lib is a little easier to write and read.
This works for me:
Note that you need to strip the first 10 bytes of the little_exif output (see line 25). Took me a while to find out 😄 !
Hey :)
would it be possible to get the exif data as raw bytes instead of writing to an image? The background is, that I'm writing an image directly to an output stream without any filesystem. So I like to build the exif data, add this to the image with
img_parts
and render the result directly in a HTTP response.And: would this exif payload be generic or is it already prepared for the output format (eg. jpeg or png)?
What do you think?
Kind regards, Florian