mirror of
https://github.com/tcsenpai/ollama.git
synced 2025-06-06 19:25:21 +00:00
change resize algorithm
This commit is contained in:
parent
71e76f8c90
commit
03cf7627ec
@ -148,7 +148,13 @@ func ResizeImage(img image.Image, outputSize image.Point, maxImageTiles int) (im
|
|||||||
newSize := getImageSizeFitToCanvas(b.Max, canvasSize, tileSize)
|
newSize := getImageSizeFitToCanvas(b.Max, canvasSize, tileSize)
|
||||||
|
|
||||||
dst := image.NewRGBA(image.Rect(0, 0, newSize.X, newSize.Y))
|
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
|
return dst, aspectRatio
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user