Browse Source

change resize algorithm

Patrick Devine 7 tháng trước cách đây
mục cha
commit
03cf7627ec
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      server/imageproc/images.go

+ 7 - 1
server/imageproc/images.go

@@ -148,7 +148,13 @@ func ResizeImage(img image.Image, outputSize image.Point, maxImageTiles int) (im
 	newSize := getImageSizeFitToCanvas(b.Max, canvasSize, tileSize)
 
 	dst := image.NewRGBA(image.Rect(0, 0, newSize.X, newSize.Y))
-	draw.ApproxBiLinear.Scale(dst, dst.Rect, img, b, draw.Over, nil)
+
+	// scaling choices:
+	//   NearestNeighbor	fast, blocky output
+	//   ApproxBiLinear	fast, medium quality
+	//   BiLinear		slow, high quality
+	//   CatmullRom		very slow, very high quality
+	draw.BiLinear.Scale(dst, dst.Rect, img, b, draw.Over, nil)
 
 	return dst, aspectRatio
 }