Skip to content

Commit

Permalink
Using lower AVIF quality for lower input quality
Browse files Browse the repository at this point in the history
  • Loading branch information
dooman87 committed Sep 15, 2020
1 parent 27e080b commit d770d60
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions img/processor/imagemagick.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,16 @@ func getConvertFormatOptions(inf *ImageInfo) []string {
}

func getQualityOptions(inf *ImageInfo, outputMimeType string) []string {
if outputMimeType == "image/avif" {
if inf.quality == 100 {
return []string{"-quality", "82"}
}

if outputMimeType == "image/avif" && inf.quality > 85 {
return []string{"-quality", "70"}
}

//Changing quality if it wasn't set in the original image
if inf.quality == 100 {
return []string{"-quality", "82"}
if outputMimeType == "image/avif" && inf.quality <= 85 {
return []string{"-quality", "60"}
}

return []string{}
Expand Down

0 comments on commit d770d60

Please sign in to comment.