From d3f2dcff3add361468ba2bf0591f1578a6f453d5 Mon Sep 17 00:00:00 2001 From: Dmitry Pokidov Date: Thu, 17 Sep 2020 21:19:52 +1000 Subject: [PATCH] Keep adjusting quality for AVIF --- img/processor/imagemagick.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/img/processor/imagemagick.go b/img/processor/imagemagick.go index 8452714..a64b435 100644 --- a/img/processor/imagemagick.go +++ b/img/processor/imagemagick.go @@ -287,12 +287,14 @@ func getQualityOptions(inf *ImageInfo, outputMimeType string) []string { return []string{"-quality", "82"} } - if outputMimeType == "image/avif" && inf.quality > 85 { - return []string{"-quality", "70"} - } - - if outputMimeType == "image/avif" && inf.quality <= 85 { - return []string{"-quality", "60"} + if outputMimeType == "image/avif" { + if inf.quality > 85 { + return []string{"-quality", "70"} + } else if inf.quality > 75 { + return []string{"-quality", "60"} + } else { + return []string{"-quality", "50"} + } } return []string{}