Created
December 4, 2025 16:23
-
-
Save jdmichaud/303c682c1accd42656e1067ab8c889b9 to your computer and use it in GitHub Desktop.
Retrieve pixels of an image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const data = await (await fetch('Tv-test-pattern-146649_640.png')).bytes(); | |
| const decoder = new ImageDecoder({ type: "image/png", data }); | |
| const frame = await decoder.decode(); | |
| const bytes = new Uint8Array(frame.image.allocationSize()); | |
| await frame.image.copyTo(bytes.buffer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment