DocumentationLearn all about jCanvas
- Clear Canvas
- Rotate Canvas
- Scale Canvas
- Translate Canvas
- Pixel Manipulation
- Get Canvas Image
- Draw Manually
- Detect Pixel Ratio
Get Canvas Image
getCanvasImage() method retrieves the canvas’s image data as a string. The string is a base64-encoded image URL, which can be used as a valid image URL for any purpose.
The default image type is PNG, although you can specify PNG, or JPEG.
If you choose to retrieve the canvas image as a JPEG, you may also set the JPEG’s quality (which ranges from
This method does not work on Google Chrome if the page is served from a file URL (
file://). This is a limitation of Google Chrome’s sandboxing architecture, and therefore cannot be fixed. However, this method still works when the page is served from a server (either online or running locally via