Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
140 stars 2 forks source link

AVIF image support #880

Open jae1911 opened 11 months ago

jae1911 commented 11 months ago

Is your feature request related to a problem? Please describe.

When loading an AVIF image, it will appear as a file which is not expected. Given websites like Google Images are slowly switching to it, it's frustrating to see a file pop up when trying to paste an image.

Describe the solution you'd like

The AVIF image should be displayed as an image instead of a file.

Describe alternatives you've considered

None.

Additional Context

Test image: https://sharex.777.tf/ShareX/2023/08/2023-08-24%2019.00.33.avif

2023-12-12 07 19 05

Frooxius commented 11 months ago

We've looked at this briefly in the past and we could potentially introduce support for this format.

Unfortunately FreeImage does not support this format, since it's relatively new.

The main thing we need is a good C# library (wrapper or native implementation) to support this format. This can be either adding support directly, or we switch away from FreeImage (which we might also do for other reasons).

However this also brings the question - how commonly is this format used? How mature is it? What benefit would there be to supporting it natively?

There are hundreds of image formats that we could potentially support, so having a bit more context on why you want this one supported would be helpful.

jae1911 commented 11 months ago

It's mature enough that Google has started rolling it out on Google images and that all major browsers have support for it (https://caniuse.com/?search=avif).

The benefit would be not having to convert the image to another format to display it in-game as copying images from services like google images will copy an AVIF file and converting it while in VR is hard and not practical.

Frooxius commented 11 months ago

@jae1911 That's good context, thank you! I think given this, we can definitely look into adding support for this natively.

No promises on when will that happen, we'll have to see if we want to swap over from FreeImage completely (which we might) and do it as part of that, or do something else, but I'd like to make it happen one way or other at some point.

Frooxius commented 5 months ago

I think we'll probably end up using libheif directly for this right now. I've created fork of the repo here: https://github.com/Yellow-Dog-Man/libheif

There's a C# wrapper: https://github.com/0xC0000054/libheif-sharp

The next step we need to start building binaries for libheif. If anybody in the community would like to help accelerate this and setup GitHub Actions to do the native builds, feel free to open a PR against our fork!

ProbablePrime commented 4 months ago

@BlueCyro Heard you were working on this?

Please assign yourself if you are, thank you!

Frooxius commented 4 months ago

I've reached out to @BlueCyro via DM asking him if he'd be interested in this, since he likes the AVIF format. Assigning him.

jae1911 commented 1 month ago

Just to log that here, I opened a PR on the libheif repository with working CI for the Windows version of the library (based on Cyro's branch that did most of the CI).

https://github.com/Yellow-Dog-Man/libheif/pull/1

BlueCyro commented 1 month ago

Just to log that here, I opened a PR on the libheif repository with working CI for the Windows version of the library (based on Cyro's branch that did most of the CI).

Yellow-Dog-Man/libheif#1

Thank you very much! I will get to this after I tame my tornado of PRs a little lol