Skip to content
This repository was archived by the owner on Aug 3, 2022. It is now read-only.

Commit ddb4853

Browse files
committed
Properly get the quality/type of base64 images.
1 parent 3042a53 commit ddb4853

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

background.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,15 @@ function TestUrl(url, port) {
166166
if (url.includes("image/webp")) {
167167
// Base64 like on Amazon.
168168
console.log("WebP in base 64.");
169-
// TODO analyze the blob properly.
169+
var i = url.search("base64") + 6;
170+
while(url[i] == "," || url[i] == " ")++i;
171+
var blob = Uint8Array.from(atob(url.substring(i)), c => c.charCodeAt(0));
172+
var quality = VP8EstimateQuality(blob);
170173
port.postMessage({
171174
"request": "webp_test_url",
172175
"url": url,
173-
"quality": 0,
174-
"type": "VP8 "
176+
"quality": quality["quality"],
177+
"type": quality["type"]
175178
});
176179
}
177180
} else {

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "WebP Highlighter",
4-
"version": "1.19",
4+
"version": "1.20",
55
"description": "Makes WebP's recognizable on a webpage.",
66
"icons": {"48": "icons/webplogo.png"},
77
"permissions": ["webRequest", "webRequestBlocking", "storage", "tabs",

0 commit comments

Comments
 (0)