drawImage and getImageData does not execute
See original GitHub issuerender:
<View style={{flex: 1}}>
<Canvas
ref={ref => {
this.tempCanvas = ref;
}}/>
.....
</View>
ImagePicker.launchImageLibrary({
mediaType: 'photo',
//allowsEditing: true,
}, (response) => {
if(!response.didCancel) {
console.log(response);
this.tempCanvas.width = response.width;
this.tempCanvas.height = response.height;
const ctx = this.tempCanvas.getContext('2d');
ctx.drawImage(`data:${response.type};base64,${response.data}`, 0, 0, response.width, response.height);
console.log(`data:${response.type};base64,${response.data}`);
ctx.getImageData(0,0,response.width,response.height)
.then(imageData => {
// does not execute
console.log(imageData);
}).catch(error => {
//does not execute
console.log(error);
});
}
});
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
canvas context getImageData() function won't execute ...
javascript - canvas context getImageData() function won't execute, probably because it's executed before the image is loaded - Stack Overflow. ...
Read more >CanvasRenderingContext2D.putImageData() - Web APIs | MDN
The CanvasRenderingContext2D.putImageData() method of the Canvas 2D API paints data from the given ImageData object onto the canvas.
Read more >HTML canvas getImageData() Method - W3Schools
The getImageData() method returns an ImageData object that copies the pixel data for the specified rectangle on a canvas. Note: The ImageData object...
Read more >68568 - Canvas: SOP error when using getImageData after ...
One would expect to be able to draw an SVG image into a canvas using drawImage and then be able to read the...
Read more >Does getImageData not work in IE at all? - Google Groups
just up a river with no paddle? ... var canvasContext = canvas.getContext( '2d' ); canvasContext.drawImage( _image, 0, 0 ); // the next line...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If @iddan don’t mind I will deal with warnings in the next pull request. About drawImage. You should use Image class from library. How? You can check it in file example/App.js. What problem/error/exception do you have with getImageData?
Can you describe clearly whether the problem is resolved ?