From 9f50c802cb27029ffc8b5336c401ef7a6f4cf1a1 Mon Sep 17 00:00:00 2001 From: Edd Hurst Date: Sun, 27 Apr 2025 19:41:51 +0100 Subject: [PATCH] docs(Readme): update toPixelData snippet to use width --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a18a2a8b..6e0a0643 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ htmlToImage .then(function (pixels) { for (var y = 0; y < node.scrollHeight; ++y) { for (var x = 0; x < node.scrollWidth; ++x) { - pixelAtXYOffset = (4 * y * node.scrollHeight) + (4 * x); + pixelAtXYOffset = (4 * y * node.scrollWidth) + (4 * x); /* pixelAtXY is a Uint8Array[4] containing RGBA values of the pixel at (x, y) in the range 0..255 */ pixelAtXY = pixels.slice(pixelAtXYOffset, pixelAtXYOffset + 4); }