canvas.toDataURL() returns a transparent image
See original GitHub issueHello, I made a simple canvas which superpose two images and I would like to get the Data64 (or even a jpg file) of it but when I do canvas.toDataURL() the output is:
Promise { "_40": 0, "_55": null, "_65": 0, "_72": null, }
Is it normal ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
canvas.toDataURL results in solid black image?
toDataURL ("image/jpeg"); var img = new Image(); img.src = data; ... use the type image/png , the background will be transparent by default....
Read more >How to create transparency in images with canvas - Patrick Wied
This article is about how to create transparency in all types of images ( .JPEG, .GIF, .PNG ) with only the html5 canvas...
Read more >HTML : toDataURL() of webgl canvas returning transparent image ...
HTML : toDataURL() of webgl canvas returning transparent image [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] HTML : toDataURL() of w ...
Read more >canvas.toDataURL() resulting in an empty transparent image
I am using blend4web to create a 3D product configurator with a varied set of options that would be live rendered. Blend4web renders...
Read more >HTMLCanvasElement.toDataURL() - Web APIs | MDN
toDataURL() method returns a data URL containing a representation of the image ... toDataURL('image/jpeg', 0.5); const lowQuality = canvas.
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 Free
Top 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
Hi, I have had a question about this too.
These methods return a promise, as you can see, so you would need to wait for it to resolve before the variable can be populated.
However, in my case the promise never actually got resolved. Here is a link to my issue: https://github.com/iddan/react-native-canvas/issues/25
If you haven’t already try rewriting with async as suggested by @iddan.
You read the canvas before it was drawn. Your code should be: