Add option to set jpeg quality level. Closes #371

This commit is contained in:
Deluan 2020-06-29 17:20:38 -04:00
parent f0ee52a98e
commit 2371e9b943
2 changed files with 2 additions and 1 deletions

View file

@ -34,6 +34,7 @@ type nd struct {
ProbeCommand string `default:"ffmpeg %s -f ffmetadata"` ProbeCommand string `default:"ffmpeg %s -f ffmetadata"`
CoverArtPriority string `default:"embedded, cover.*, folder.*, front.*"` CoverArtPriority string `default:"embedded, cover.*, folder.*, front.*"`
CoverJpegQuality int `default:"75"`
// DevFlags. These are used to enable/disable debugging and incomplete features // DevFlags. These are used to enable/disable debugging and incomplete features
DevLogSourceLine bool `default:"false"` DevLogSourceLine bool `default:"false"`

View file

@ -163,7 +163,7 @@ func resizeImage(reader io.Reader, size int) ([]byte, error) {
} }
m := imaging.Resize(img, size, size, imaging.Lanczos) m := imaging.Resize(img, size, size, imaging.Lanczos)
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
err = jpeg.Encode(buf, m, &jpeg.Options{Quality: 75}) err = jpeg.Encode(buf, m, &jpeg.Options{Quality: conf.Server.CoverJpegQuality})
return buf.Bytes(), err return buf.Bytes(), err
} }