read-pixels
Super Lightweight Function to Read Pixels in the Browser
Reads Pixels from JPG, PNG, and WebP Files in Multiple Formats, including ArrayBuffer, Data URL, Files, Response, and Typed Array.
why?
:zero: Zero Dependencies
:rocket: Super Lightweight at 1.24 KB File Size
install
npm install read-pixels
usage
import readPixels from 'read-pixels';
const result = await readPixels({
data: await fetch("./flower.png").then(r => r.arrayBuffer()),
debug: true
});
const result = await readPixels({
data: fetch("./flower.png"),
debug: true
});
const result = await readPixels({
data: "data:image/png;base64,...",
debug: true
});