From 407d1d1f09dce622426b71ee800480534c8e0888 Mon Sep 17 00:00:00 2001 From: yisibl Date: Mon, 25 Oct 2021 15:12:48 +0800 Subject: [PATCH] fix: avif encoding is too slow --- index.js | 20 ++++++++++---------- src/lib.rs | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index c52f6f59..c386027c 100644 --- a/index.js +++ b/index.js @@ -227,10 +227,10 @@ function createCanvas(width, height, flag) { this, type, JSON.stringify({ - quality: 92, + quality: 80, alphaQuality: 92, threads: 0, - speed: 1, + speed: 4, ...(qualityOrConfig || {}), }), ) @@ -244,10 +244,10 @@ function createCanvas(width, height, flag) { this, type, JSON.stringify({ - quality: 92, + quality: 80, alphaQuality: 92, threads: 0, - speed: 1, + speed: 4, ...(qualityOrConfig || {}), }), ) @@ -261,10 +261,10 @@ function createCanvas(width, height, flag) { this, type, JSON.stringify({ - quality: 92, + quality: 80, alphaQuality: 92, threads: 0, - speed: 1, + speed: 4, ...(qualityOrConfig || {}), }), ) @@ -278,10 +278,10 @@ function createCanvas(width, height, flag) { this, type, JSON.stringify({ - quality: 92, + quality: 80, alphaQuality: 92, threads: 0, - speed: 1, + speed: 4, ...(qualityOrConfig || {}), }), ) @@ -295,10 +295,10 @@ function createCanvas(width, height, flag) { this, type, JSON.stringify({ - quality: 92, + quality: 80, alphaQuality: 92, threads: 0, - speed: 1, + speed: 4, ...(qualityOrConfig || {}), }), ) diff --git a/src/lib.rs b/src/lib.rs index 8191a427..0a8ab841 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,7 +45,7 @@ const MIME_PNG: &str = "image/png"; const MIME_JPEG: &str = "image/jpeg"; const MIME_AVIF: &str = "image/avif"; -const DEFAULT_IMAGE_QUALITY: u8 = 92; +const DEFAULT_IMAGE_QUALITY: u8 = 80; #[module_exports] fn init(mut exports: JsObject, env: Env) -> Result<()> {