scijs / get-pixels

Reads an image into an ndarray
MIT License
543 stars 108 forks source link

Path must be a string, received {255.....} #61

Open thomascouto opened 1 year ago

thomascouto commented 1 year ago

Hello, I'm trying to use get-pixels with Uint8array, but I'm stuck in this error.

TypeError: Path must be a string. Received {"0":255,"1":216,"2":255,"3":224,"4":0,"5":16,"6":74,"7":70,"8":73,"9":..........................255}

Types: declare function getPixels(path: string | Uint8Array, type: string, callback: Callback): void

Test code: const arr = new Uint8Array(path);

console.log(arr); //is a Uint8array

getPixels(arr, 'image/jpg', (err, pixels) => { console.log(pixels); });

Any suggestions ?