Open zdcthomas opened 3 years ago
That isn't possible with this library yet. My suggestion would be to use an external tool to do the conversion like say ImageMagick
Is there something blocking development on that functionality/ is there anyone currently working on that?
There are a few ways to wrap libheif
and mp4parse
but I'm not aware of any Rust native crate that is specifically dedicated to generically demuxing isobmff as heif, nor to H.265
decoding. I imagine this is in parts due to the large patent encumbrance surrounding all of MPEG's technical work. This of course precludes the availabilty of HEIC decoding and encoding.
I think instead of HEIC one should focus resources onto AVIF: #1152
The patent situation there is way better.
When iOS users enable the "live photo" option, their camera software creates HEIC files. My rust server must process those files.
My plan is to make my app convert all images to JPEG before uploading. I will try the Dart library https://pub.dev/packages/heic_to_jpg in my Flutter app.
Hello everyone. Are there any positive news on this matter now in Dec 2021 ? I would like to use Rust to convert .HEIC photo images to JPG/JPEG photo images and save resulting JPG on disk. Right now I am using a GUI program to do it manually, which works OK but I am looking for a Rust-based programmatic solution to deal with HEIC photos. Thank you for any guidance.
This issue (like similar issues for other large feature requests) is blocked on either someone coming by that wants to implement it, or else another Rust crate being written that exposes the desired functionality in a way we can use.
I know it is not the answer you were hoping for, but sadly at this point none of the maintainers have the time and energy to make big feature additions. Which means that the majority of development comes down to contributors stepping in to write features they want for themselves, and of course we can't really predict when/if that'll happen for any given request
Just a note that while mp4parse gets most of the way there on account of AVIF and HEIC being very similar at the container level, the hard problem of HEIC support is that the patents which cover the codec itself are not free. The best way forward would probably be to integrate libheif (perhaps via https://crates.io/crates/libheif-sys) to handle decoding. With that, the changes to mp4parse to get HEIC files demuxed should be pretty minimal.
I would like be able to use Image-rs to decode .heic
files in a program I'd like to write. I wouldn't mind adding support for .heic
files. Unfortunately I can't find any specific enough information about the structure of .heic
files. If someone could point me in the right direction, I'm sure I'd figure it out eventually.
HEIC has basically the same container structure as AVIF since they're both based on the ISO/IEC 23008-12:2017 HEIF standard (free download). This library already uses https://github.com/mozilla/mp4parse-rust, which I added AVIF parsing support to, so most of that work is done.
That said, they AVIF and HEIC differ at the codec level. AVIF uses AV1, while HEIC uses HEVC, which is neither free nor open. If you're interested, I'd suggest starting with https://github.com/strukturag/libde265. It doesn't seem to have a rust wrapper yet, so that'd be a nice community addition.
Thanks. What do you mean when you say that HEVC "is neither free nor open"?
I mean that unlike AV1, HEVC is not free to use and there's no open source reference implementation
I would like be able to use Image-rs to decode
.heic
files in a program I'd like to write. I wouldn't mind adding support for.heic
files. Unfortunately I can't find any specific enough information about the structure of.heic
files. If someone could point me in the right direction, I'm sure I'd figure it out eventually.
The heic is base of ISO bmff(ISO_base_media_file_format).
https://en.wikipedia.org/wiki/ISO_base_media_file_format https://mpeg.chiariglione.org/standards/mpeg-4/iso-base-media-file-format
I know an open source project of heif: https://github.com/nokiatech/heif
Is anyone here aware of libheif-rs
? It's a wrapper around another library and is dependent on the libheif
binary being installed. Has anyone considered using it in this project? I imagine getting image
to be able to decode and encode .heic
files using libheif-rs
would be a lot simpler/easier than implementing the functionality from scratch or using another library.
Are there any reasons libheif-rs
cannot be used or would be undesirable?
The two concerns with linking to libhief
would be:
There seem to be 3 libraries that are dependent on libheif
installed on my laptop. If they can use it, then surly so can image
without legal repercussions. Right?
I have no idea. Maybe they've consulted lawyers and take specific precautions? Or the developers are in a country where it isn't as much of a concern? Or it could just be a matter of time until they run into problems
One of them is called OpenImageIO.
How does one decode an heic encoded image? Is there a current way that I'm missing to decode an heic image, OR convert it to an image format that I can also operate on, like a jpeg?
Overall, I'm trying to resize an heic encoded image.
I saw that there isn't decoding support for avif, but I'm more specifically interested in heic encoded images. Thanks! Sorry if this is an obvious question!