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) #851

Open
LITUATUI opened this issue Mar 23, 2022 · 3 comments
Open

Add support for modern image formats (AVIF, JXL and WebP) #851

LITUATUI opened this issue Mar 23, 2022 · 3 comments

Comments

@LITUATUI
Copy link

LITUATUI commented Mar 23, 2022

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.

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
@icy-comet
Copy link
Contributor

icy-comet commented Jul 24, 2022

Not to nag, but does this align with your goals for PaperMod @adityatelange?

Adding support for this would simply include tweaking the figure shortcode. Would you be open to accept such a PR?

Here's the support graph for the picture element and here's the one for the figure element. And here's a SO question regarding the use of picture inside figure element.

@mbootsman
Copy link

I'm looking for a way to have Hugo generate modern image format of images used in page bundles. I hope this will be included in a next version of PaperMod. Thanks

@istvnurbn
Copy link

Please, make it happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants