feat(提升性能): 更快的加载图片
build.yaml / build (push) Successful in 38s

This commit is contained in:
2026-07-13 16:17:08 +08:00
parent 19ba4562a1
commit 1004781aed
2 changed files with 17 additions and 0 deletions
+4
View File
@@ -19,6 +19,7 @@ import (
"image/color"
"github.com/tdewolff/canvas"
canvas_image "github.com/tdewolff/canvas/image"
)
// renderImage 渲染图片
@@ -112,6 +113,9 @@ func imageWithTransparentEdge(img image.Image) (image.Image, int) {
if w == 0 || h == 0 {
return img, 0
}
if src, ok := img.(*canvas_image.Image); ok && src.Mimetype == "image/jpeg" && src.Mask == nil {
return img, 0
}
if opaque, ok := img.(interface{ Opaque() bool }); ok && opaque.Opaque() {
return img, 0
}