You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert(base64Body,'screenshotBase64 must include image data');
57
-
returncreateImgBase64ByFormat(
58
-
inferBase64ImageFormat(base64Body),
59
-
base64Body,
60
-
);
61
-
};
62
39
63
40
constlegacyScrollTypeMap={
64
41
once: 'singleAction',
@@ -203,23 +180,13 @@ export async function commonContextParser(
203
180
shrunkShotToLogicalRatio,
204
181
};
205
182
}else{
206
-
// For screenshots that do not need shrinking, convert PNG to JPEG to reduce the image payload in model requests and reports. (Shrunk images are already JPEG.)
207
-
// This mainly covers Android's default screenshot path, which produces PNG screenshots.
208
-
// Compared with conversion on Android, centralizing it here means each platform does not need to handle screenshot formats itself, and allows future output formats such as WebP.
209
-
// Built-in paths that already output JPEG are unaffected, and custom devices that output JPEG will not be compressed again.
210
-
// The Web platform already outputs JPEG, so it does not enter this branch. Other built-in device platforms run in Node, where Sharp conversion is fast enough that its extra cost is negligible.
211
-
letoutputScreenshotBase64=screenshotBase64;
212
-
const{ mimeType, body }=parseBase64(screenshotBase64);
213
-
if(mimeType.toLowerCase()==='image/png'){
214
-
constjpegBuffer=awaitconvertImgBufferToJpeg(
215
-
Buffer.from(body,'base64'),
216
-
90,
217
-
);
218
-
outputScreenshotBase64=createImgBase64ByFormat(
219
-
'jpeg',
220
-
jpegBuffer.toString('base64'),
221
-
);
222
-
}
183
+
// PNG/raw producers are encoded once as WebP before the ScreenshotItem is
184
+
// shared by model requests and reports. Native JPEG sources are preserved
185
+
// to avoid a second lossy encode for MJPEG/HDC frames.
0 commit comments