[Feature] Browser independent support for HEIC decoding (libheif) #31271
soulintransition
started this conversation in
Feature Request
Replies: 2 comments 2 replies
|
...is this a feature request? |
1 reply
|
@yann117 Would you be willing to test out this feature? How familiar are you with VMs and second instances? I just need someone who knows how to do regression tests to test out this code and see if it works. If worse comes to worse, I can always try it first myself on a custom instance, I put it on Reddit but I haven't heard any replies yet. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I have searched the existing feature requests, both open and closed, to make sure this is not a duplicate request.
The feature
Adding a libheif-based worker which launches on browsers which don't support HEIC to decode HEICs into bitmaps for display and short-term caching on client side. No expensive webhook or double-sized JPG on your disk; just libheif decoding inside the browser using the codecs you probably already have.
Disclaimer: This may be slower than the normal original fetch process. For that reason, some people might want to have a setting in account settings which pre-loads the HEIC and starts the worker after the first three seconds on an asset. I didn't want that because of disc longevity, but I figure you all can add a toggle switch for such functionality later.
Here is some introductory code I provided. The cache size is set to 3, you may want to change it or make it variable for slower devices. A 1280x960 bitmap is worlds different from a 5712x4284 bitmap, after all. You can test it out, refactor, throw out entirely and do from the ground up. The changes, to my knowledge, involve extensive additions to AdaptiveImage.svelte and the creation of two new files: web/src/lib/utils/heic-worker.js and web/src/lib/utils/heic-ram-cache.ts
TestCode.pdf
If anyone's brave enough to take a test drive, feel free!
Platform
All reactions