Skip to content

Commit

Permalink
Fix blurry images on Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
WasabiThumb committed Jul 8, 2024
1 parent c233498 commit 0192bb1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
A lightweight QR encoder for the browser & node loosely based on [zxing](https://github.com/zxing/zxing).
This is strictly a QR encoder & renderer, future updates should consist mainly of bug fixes.

[Live Demo](https://jsfiddle.net/5rept9nf/5/) | [GitHub](https://github.com/WasabiThumb/enqr/) | [NPM](https://www.npmjs.com/package/enqr)

## Usage (Browser)
```html
<img id="qr" src="" alt="QR Code">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "enqr",
"description": "Lightweight QR encoder for the browser & node loosely based on zxing",
"version": "1.1.1",
"version": "1.1.2",
"main": "dist/index.js",
"types": "types/index.d.ts",
"homepage": "https://github.com/WasabiThumb/enqr",
Expand Down
3 changes: 2 additions & 1 deletion src/qr/qrcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ class QRCodeImpl implements QRCode {
const url = await this.renderToURL(options);
img.addEventListener("load", () => {
if (revoke && url.startsWith("blob:")) URL.revokeObjectURL(url);
img.style.imageRendering = "crisp-edges";
img.style.imageRendering = "pixelated";
if (window.getComputedStyle(img).imageRendering !== "pixelated") img.style.imageRendering = "crisp-edges";
img.style.objectFit = "contain";
res(img);
});
Expand Down

0 comments on commit 0192bb1

Please sign in to comment.