Automattic / Automattic/node-canvas
Usage of createImageData()
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 1.2k
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
Hello,
I want to use image data as input of Tensorflow : image = _tfnode.node.decodeImage( imageData);
For my side, data is coming from a webbrowser as following :
```
canvasElement.toBlob( function (blob) {
let src = canvasElement.toDataURL("image/png");
ws.send( { src: src, width: canvasElement.width, height: canavasElement.height } );
...
```
So I send this message to an other application (through websocket), and then, nn reception of 'receivedMessage':
```
function dataURLToBlob( dataURL) {
let datas = dataURL.split( ",");
let buffer1 = Buffer.from(datas[1]);
let buffer = Uint16Array.from(buffer1);
return buffer;
}
const myUint16ArrayBuffer = dataURLToBlob( receivedMessage.imgSrc);
const imageData = createImageData( myUint16ArrayBuffer, receivedMessage.width, receivedMessage.height);
```
So, what should I do with 'imageData' to create a canvas ?
Best regards.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.