From cd84e43b3e94190990076993705de3f4653620ba Mon Sep 17 00:00:00 2001 From: Florian Bury Date: Thu, 7 Mar 2024 13:23:49 +0100 Subject: [PATCH] FI Optimize Image-Scaling --- internal/imgHandler/resize.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/imgHandler/resize.go b/internal/imgHandler/resize.go index 4d48dd0..546a279 100644 --- a/internal/imgHandler/resize.go +++ b/internal/imgHandler/resize.go @@ -10,7 +10,7 @@ import ( func ResizeImage(src_path string, dst_path string, width int) (string, error) { srcImage, err := imaging.Open(src_path, imaging.AutoOrientation(true)) - dstImage800 := imaging.Resize(srcImage, width, 0, imaging.Lanczos) + dstImage800 := imaging.Resize(srcImage, width, 0, imaging.Linear) // Create the file to which the resized image will be written. out, err := os.Create(dst_path) @@ -21,7 +21,7 @@ func ResizeImage(src_path string, dst_path string, width int) (string, error) { defer out.Close() // Encode and write the resized image to the new file. - err = jpeg.Encode(out, dstImage800, nil) + err = jpeg.Encode(out, dstImage800, &jpeg.Options{Quality: 55}) if err != nil { log.Error(err) return "", err