Skip to content

Commit

Permalink
Better quality factor for AVIF
Browse files Browse the repository at this point in the history
  • Loading branch information
cramforce committed Feb 17, 2021
1 parent 5ed39db commit 22922aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion _11ty/srcset.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ const extension = {
avif: "avif",
};

const quality = {
avif: 40,
default: 60,
};

module.exports = async function srcset(filename, format) {
const names = await Promise.all(
widths.map((w) => resize(filename, w, format))
Expand All @@ -51,7 +56,7 @@ async function resize(filename, width, format) {
.rotate() // Manifest rotation from metadata
.resize(width)
[format]({
quality: 60,
quality: quality[format] || quality.default,
reductionEffort: 6,
})
.toFile("_site" + out);
Expand Down

0 comments on commit 22922aa

Please sign in to comment.