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

Add support for modern image formats (AVIF, JXL and WebP) with fallback #121

Open
imfing opened this issue Oct 2, 2023 Discussed in #117 · 0 comments
Open

Add support for modern image formats (AVIF, JXL and WebP) with fallback #121

imfing opened this issue Oct 2, 2023 Discussed in #117 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@imfing
Copy link
Owner

imfing commented Oct 2, 2023

Discussed in #117

Originally posted by LITUATUI October 2, 2023
Support for modern image formats is a great way to improve the speed of a website.

The Hugo Clarity theme has a great way of dealing with new image formats like AVIF, JXL or WebP.

If you reference an image such as sample.jpg in your post, Hugo Clarity will check to see if the same image (based on filename) exists in the modern formats of WebP, AVIF or JXL. If it does, these will be presented to browsers as alternative options. Browsers that can support these formats will load them, while browsers that do not will fall-back to the default image.

This process works for images with the file extensions jpg, jpeg, png, and gif.

Implemented this way would have no disadvantages even for old browsers that don't support modern image formats.

Hugo Bootstrap Theme also implemented this neat feature.

Then we can use ImageMagick to batch convert all JPG and PNG files in our image folder.

magick mogrify -format avif -depth 10 -define heic:speed=2 *.jpg

magick mogrify -format avif -depth 10 -define heic:speed=2 *.png
```</div>
@imfing imfing added the enhancement New feature or request label Oct 2, 2023
@imfing imfing added this to the Backlog milestone Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant