fix: ocr cluster

This commit is contained in:
huangbin.beal@163.com
2024-03-19 11:53:28 +08:00
parent c1be585d5e
commit 4979d4e1e2
2 changed files with 3 additions and 7 deletions

View File

@@ -4,9 +4,9 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"image" "image"
"image/gif" _ "image/gif"
"image/jpeg" "image/jpeg"
"image/png" _ "image/png"
"math/rand" "math/rand"
"mime" "mime"
"mime/multipart" "mime/multipart"
@@ -256,10 +256,6 @@ func (dExt *DriverExt) saveScreenShot(raw *bytes.Buffer, fileName string) (strin
case "jpeg", "png": case "jpeg", "png":
jpegOptions := &jpeg.Options{Quality: 95} jpegOptions := &jpeg.Options{Quality: 95}
err = jpeg.Encode(file, img, jpegOptions) err = jpeg.Encode(file, img, jpegOptions)
case "png_import":
err = png.Encode(file, img)
case "gif_import":
err = gif.Encode(file, img, nil)
default: default:
return "", fmt.Errorf("unsupported image format: %s", format) return "", fmt.Errorf("unsupported image format: %s", format)
} }

View File

@@ -219,7 +219,7 @@ func (s *veDEMImageService) GetImage(imageBuf *bytes.Buffer, options ...ActionOp
} }
// 使用高精度集群 // 使用高精度集群
bodyWriter.WriteField("ocrCluster", "default_1600") bodyWriter.WriteField("ocrCluster", "highPrecision")
if actionOptions.ScreenShotWithOCRCluster != "" { if actionOptions.ScreenShotWithOCRCluster != "" {
bodyWriter.WriteField("ocrCluster", actionOptions.ScreenShotWithOCRCluster) bodyWriter.WriteField("ocrCluster", actionOptions.ScreenShotWithOCRCluster)