1fd4f7b8c872
fix Aztec decode: white-fill canvas before drawImage so transparent quiet-zone pixels composite to white instead of packing as black in ZXing ARGB
- time
- 2026-05-19 05:19 UTC · 5 months ago
- machine
- koh2
- parent
- 21044a32a4a4
↓ peach-browser-1fd4f7b8.tar.gzatlas at this save
files changed1 file
src/popup/codex/aztec.ts+6 −0src/popup/codex/aztec.ts+6 −0
@@ -174,6 +174,12 @@174174 const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);175175 const ctx = canvas.getContext("2d");176176 if (!ctx) return null;177+ // White-fill before drawing so any transparent pixels in the PNG178+ // composite to white rather than (0,0,0,0). Transparent pixels get179+ // packed as 0xFF000000 (black) in the ARGB array, which would make180+ // the quiet-zone border appear black and confuse ZXing.181+ ctx.fillStyle = "#ffffff";182+ ctx.fillRect(0, 0, bitmap.width, bitmap.height);177183 ctx.drawImage(bitmap, 0, 0);178184 const imageData = ctx.getImageData(0, 0, bitmap.width, bitmap.height);179185