-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Assets: Can't use AVIF image source #8056
Comments
I see here that astro/packages/astro/src/assets/consts.ts Lines 4 to 11 in f39a80c
It looks like relavant usage of Since |
Note that while probe-image-size supposedly works out of the box with AVIF, HEIF and HEIC, along with existing supported formats. |
I know Since there's already a TODO in the codebase, I think it's safe to say that we're already aware of/tracking this. Not sure if @Princesseuh has anything else to add? |
Yep, exactly what Nate said. Until Sharp can safely run everywhere, we can't depend on it in the core codebase super safely. Replacing with
|
I tried making the following changes:
I then tried importing an AVIF image into an I also tried importing an HEIC image (sample). I didn't see an error in the console, but the converted image failed to load with a 500 response—I assume this is because the Squoosh image service doesn't support HEIC / HEIF due to licensing issues, similar to why sharp can't support those formats. GoogleChromeLabs/squoosh#733 (comment) Since the AVIF part works and isn't tied up in licensing difficulties, maybe we could start with that format? That's all I need for my use case at least. I can make a PR for this. |
@mattrossman out of curiosity are you manually converting your images to avif/heic and what is your use case more specifically, are you trying to use picture element for multiple formats or you would just like to only serve modern formats? I ask because I would like to support modern formats with Astro as well but this is area is still in development, hopefully might help drive this forward. |
@gvkhna My reason for using AVIF image inputs is that they tend to be the smaller on-disk than other formats I've tested, so for images I'm storing locally in a project (e.g. for a personal blog) it's creates less bloat in my Git history. I use the I would probably want them to be down-converted to a more widely supported format in the build. If it could also serve the modern format in a picture element too, that'd be nice. |
For reference here is the commit that adds AVIF input support in my fork: 7b2bcbc I think in order to turn this into a proper PR I'd like to know:
|
It would be nice, but it's not necessary, we already have a lot of tests that test the entire pipeline that would fail if this didn't work, so heh.
Not if it works as a normal dependency, the only reason
The part shown in the commit is fine, you can also remove the |
What version of
astro
are you using?2.10.7
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn
What operating system are you using?
macOS
What browser are you using?
Chrome
Describe the Bug
When using experimental Assets:
Referencing a relative
.avif
image from a.md
page produces a console error about "Missing image dimensions...".Importing an
.avif
image in an.astro
file produces a "Cannot find module..." type error.What's the expected result?
AVIF can be used as an image input similar to other formats like JPEG, PNG, WebP, etc.
Link to Minimal Reproducible Example
https://github.com/mattrossman/astro-assets-avif-input
Participation
The text was updated successfully, but these errors were encountered: