Skip to content
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

Evaluate libheif alternative #483

Open
swissspidy opened this issue May 22, 2024 · 9 comments
Open

Evaluate libheif alternative #483

swissspidy opened this issue May 22, 2024 · 9 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed p3

Comments

@swissspidy
Copy link
Owner

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

@swissspidy swissspidy added the enhancement New feature or request label May 22, 2024
@swissspidy
Copy link
Owner Author

Related #322

@swissspidy swissspidy added p2 documentation Improvements or additions to documentation and removed enhancement New feature or request labels Jun 6, 2024
@swissspidy
Copy link
Owner Author

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

@swissspidy
Copy link
Owner Author

ffmpeg added some support for decoding still images, see https://trac.ffmpeg.org/ticket/6521 / FFmpeg/FFmpeg@a082134

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.

@swissspidy
Copy link
Owner Author

There is also https://github.com/dlemstra/magick-wasm but it's under Apache 2.0, so not compatible either

@swissspidy
Copy link
Owner Author

So I was very excited about FFmpeg/FFmpeg@a082134 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.

@swissspidy
Copy link
Owner Author

swissspidy commented Jul 25, 2024

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... 🤔 🤷

@swissspidy
Copy link
Owner Author

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? 🤔

@swissspidy
Copy link
Owner Author

Closing for now in favor of #578

@swissspidy swissspidy closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
@swissspidy swissspidy added help wanted Extra attention is needed p3 and removed p2 labels Sep 12, 2024
@swissspidy
Copy link
Owner Author

Reopening for visibility

@swissspidy swissspidy reopened this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed p3
Projects
None yet
Development

No branches or pull requests

1 participant