Open swissspidy opened 5 months ago
Related #322
Related: https://core.trac.wordpress.org/ticket/53645
Due to the license issue with libheif, using the server to convert images could be an alternative route. One could "upload" a HEIF image and get a JPEG in return, and then continue processing from there.
There is also https://github.com/nokiatech/heif/tree/gh-pages with a proprietary license
ffmpeg added some support for decoding still images, see https://trac.ffmpeg.org/ticket/6521 / https://github.com/FFmpeg/FFmpeg/commit/a0821345eb31b727d93c9c3ed7d74d2774c73afa
So this could be an alternative.
Caveat: only available in ffmpeg 7.0, while ffmpeg.wasm is still on 5.1.x
Related:
Could try forking https://github.com/ffmpegwasm/ffmpeg.wasm if this path is viable.
There is also https://github.com/dlemstra/magick-wasm but it's under Apache 2.0, so not compatible either
So I was very excited about https://github.com/FFmpeg/FFmpeg/commit/a0821345eb31b727d93c9c3ed7d74d2774c73afa as it was mentioned that it worked fine for all the still test images from Nokia.
I updated my ffmpeg to version 7.0.1 for testing and even forked ffmpeg.wasm to patch together a version running with ffmpeg v7. Both worked well for those test images
However, photos from my iPhone (both still images and live photos) didn't decode properly, or I'm simply using it wrong.
I've tried simple ffmpeg -i input.heic output.jpg
but also the -man 0
option (stream selection) or -vframes 1
with no luck. Either I am getting like 50 small pieces of the whole image, or it is grayscale/super dark.
An alternative could perhaps be converting https://github.com/NeverMendel/heif-convert to wasm.
An alternative could perhaps be converting NeverMendel/heif-convert to wasm.
Briefly tried this with py2wasm and wasmer, but to no avail. Getting RuntimeError: indirect call type mismatch
Edit: also, heif-convert uses pollow, which in turn uses libheif, but they say the binaries are GPLv2, soo... 🤔 🤷
Also worth noting that the example apps at https://github.com/strukturag/libheif are distributed under MIT, so maybe that means those could be converted to WASM and used in a GPL context? 🤔
Closing for now in favor of #578
Reopening for visibility
If we'd want to bundle the script with the project, then we might need to find a GPL 2.0 compatible alternative, to
libheif-js
See https://www.gnu.org/licenses/gpl-faq.html#GPLStaticVsDynamic and https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic