Giter VIP home page Giter VIP logo

Comments (7)

gregives avatar gregives commented on June 3, 2024 1

Thank you both for your comments! I'll experiment with reducing the quality of both AVIF and WEBP to see how much that improves build times. If it still takes a long time, I'll consider adding a permanent cache or giving the user the option of what image formats to output.

from twelvety.

theapplegates avatar theapplegates commented on June 3, 2024 1

I think that is a good solution.

from twelvety.

theapplegates avatar theapplegates commented on June 3, 2024

Malte Ubl, over at https://github.com/google/eleventy-high-performance-blog , added a cache option since sharp converting to avif was so slow.

#!/bin/sh

cp _site/img/remote/* img/remote/
cp _site/img/* img/
git status
git add img/
git commit -m "Persist images"

The script is titled .persistimages.sh and it is mentioned while the blog is building if the conversion is running slow.

Just a thought if you wanted to cache the images.

from twelvety.

vandenbosm avatar vandenbosm commented on June 3, 2024

In my personal code, i've reduced the quality of the avif files to around 35. This has sped up creation times and have created the great looking images at about 50% of the WebP sizes.

from twelvety.

vandenbosm avatar vandenbosm commented on June 3, 2024

I've also reduced the WebP quality to 60 as it also still maintains a very good quality at that range.

from twelvety.

gregives avatar gregives commented on June 3, 2024

I've created a pull request which adds image formats to the Twelvety options file .twelvety.js, so that users can easily disable a format and change the quality. Do you think this is a good solution?

from twelvety.

vandenbosm avatar vandenbosm commented on June 3, 2024

Hi, I think that is a good solution and your implementation is very good! Sorry I didn't get to answer you yesterday!

I would almost recommend updating the twelvity.imageFormats to be more explicit:

 imageFormats {
   avif: {
    extension: "avif",
    quality: 30
  },
   webp: {
    extension: "webp",
    quality: 60
  },
   jpeg: {
    extension: "jpeg",
    quality: 75
  }
}

This way, future users know what the "Numbers" stand for and what they are setting and also enables future properties to be added with minimal work (e.g. set a custom background color for that image while loading in case you don't want to use the generated color: backgroundLoadingColor: "#FEFEFE")

Cheers 🍻

from twelvety.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.