question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

return a black screen when convert canvas to image

See original GitHub issue

Platform: Android

Expected behavior

screenshot of canvas

Actual behavior

return a black screen

In my render() method

<ViewShot ref="viewShot" options={{ format: "jpg", quality: 0.9, result: "base64" }}>
    <View collapsable={false}>
        <Canvas ref={this.mycanvas} style={{ width: deviceWidth, height: canvasHeight }} crossOrigin="Anonymous" 
        />
     </View>
</ViewShot>

method to capture

this.refs.viewShot.capture().then(uri => {
    console.log("do something with ", uri);
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sobanarshad85commented, Jan 28, 2019

repalce your format jpg to png or any other and it’s done

0reactions
obiwankenoobicommented, Aug 18, 2021

@dean9703111 found a solution

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does my canvas go blank after converting to image?
I am trying to convert the canvas element on this page to a png using the following snippet (e.g. enter in JavaScript console):...
Read more >
toDataURL png gets a black background · Issue #282 - GitHub
Using jpeg, the canvas.toDataURL method returns a black image ( known bug in the library I'm using to convert a svg to a...
Read more >
How to resolve Canvas.todataurl() which returns a black ...
Hi,. You can use toDataURL to convert canvas to image. function convertCanvasToImage(canvas) {.
Read more >
Manipulating video using canvas - Web APIs | MDN
This tutorial demonstrates how to perform chroma-keying (also known as the "green screen effect") using JavaScript code. The document content. The HTML document ......
Read more >
Canvas - Android Developers
Save the canvas state, draw the picture, and restore the canvas state. ... Returns the maximum allowed height for bitmaps drawn with this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found