feat(thumb): change image type to NRGBA when do resize to keep transparency (#3207)

This commit is contained in:
Darren Yu
2026-01-23 15:31:42 +08:00
committed by GitHub
parent 2ecc7f4f59
commit 5b214beadc

View File

@@ -120,7 +120,7 @@ func Thumbnail(maxWidth, maxHeight uint, img image.Image) image.Image {
func Resize(newWidth, newHeight uint, img image.Image) image.Image {
// Set the expected size that you want:
dst := image.NewRGBA(image.Rect(0, 0, int(newWidth), int(newHeight)))
dst := image.NewNRGBA(image.Rect(0, 0, int(newWidth), int(newHeight)))
// Resize:
draw.BiLinear.Scale(dst, dst.Rect, img, img.Bounds(), draw.Src, nil)
return dst