diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index e764e622..38b378c2 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v4.3.6.2310111458 \ No newline at end of file +v4.3.7.2310312044 \ No newline at end of file diff --git a/hrp/pkg/uixt/ext.go b/hrp/pkg/uixt/ext.go index 54009453..46b571c2 100644 --- a/hrp/pkg/uixt/ext.go +++ b/hrp/pkg/uixt/ext.go @@ -239,7 +239,9 @@ func (dExt *DriverExt) saveScreenShot(raw *bytes.Buffer, fileName string) (strin return "", errors.Wrap(err, "decode screenshot image failed") } - screenshotPath := filepath.Join(fmt.Sprintf("%s.%s", fileName, format)) + // The default format uses jpeg for compression + screenshotPath := filepath.Join(fmt.Sprintf("%s.%s", fileName, "jpeg")) + // screenshotPath := filepath.Join(fmt.Sprintf("%s.%s", fileName, "jpeg")) file, err := os.Create(screenshotPath) if err != nil { return "", errors.Wrap(err, "create screenshot image file failed") @@ -249,11 +251,15 @@ func (dExt *DriverExt) saveScreenShot(raw *bytes.Buffer, fileName string) (strin }() switch format { - case "png": + // Convert to jpeg uniformly and compress with a compression rate of 95 + case "jpeg", "png": + jpegOptions := &jpeg.Options{Quality: 95} + err = jpeg.Encode(file, img, jpegOptions) + case "png_import": err = png.Encode(file, img) - case "jpeg": - err = jpeg.Encode(file, img, nil) - case "gif": + // case "jpeg": + // err = jpeg.Encode(file, img, nil) + case "gif_import": err = gif.Encode(file, img, nil) default: return "", fmt.Errorf("unsupported image format: %s", format)