hongru / canvas2image Goto Github PK
View Code? Open in Web Editor NEWa tool for saving or converting canvas as img
a tool for saving or converting canvas as img
First of all a big thank you to the creaters and contributors for this wonderful plugin. It works wonderfully in Chrome and Mozilla. But some how the file download doesnt happen for IE11 for PNG or JPG formats. We dont even get any error in the console. Wonder if i am missing something ?
cannot proceed the canvas after doing drawImage.
I got an error "Canvas2Image is not defined", I wrote correct code but i still have the error.
no test
no extension name
even if the operation is too fast, reported error Canvas2Image is undefined
First thank you, i use your demo, but can not download the picture in IE, please tell me how to solve this problem?
Would be great if you could set the name of the file you're downloading.
Then it will convert to one black picture
The table exports the image and the saveAsImage browser gets stuck because the data in one field of the data is too large
Hi,
I am getting the following console error and the image is not downloading
Error: Not allowed to navigate top frame to data URL: data:,
The image generation does not work on Safari for iOS. Note: It works with Chrome and it works with Safari for Mac.
But on iPhone/ iPad with Safari browser the output is always a blank white image.
Currently Canvas2Image does not export entire canvas as image. It only exports the visible area of the canvas. Is there any way it can be achieved?
document.getElementById('canvas').addEventListener("click", () => {
html2canvas(document.body).then(function(canvas) {
canvas.toBlob(function(blob) {
var a = document.createElement('a')
var event = new MouseEvent('click')
var url = URL.createObjectURL(blob);
a.download = '下载图片名称'
a.href = url
a.dispatchEvent(event)
});
})
})
Any way to help out with image quality? Looks pretty gnar...
The GitHub pages demo link is broken for me, I think the settings may have been changed to disable this site. It would be helpful if you could either remove the demo link or get the demo up and running again :)
how I claim this ?
After installing canvas2image npm. I am getting the following error:
TypeError: Canvas2Image.saveAsPNG is not a function
How I claim this issue to remove background in canvas?
Hi,
I would like to know under that license is distributed
Thanks,
Guillermo
how to set the suffix for images
thanks.
I thought I can download canvas image with its extension... But it only gives me "download" as a file.
Such thing I can achieve simply by this codes:
var image = document.getElementsByTagName("canvas")[0].toDataURL("image/png").replace("image/png", "image/octet-stream"); window.location.href=image;
Hi! I'm testing this addon with game engines (GameMaker Studio and Construct 2), but, when I add a button/link/function to call Canvas2Image functions (saveAsImage for example), the downloaded file is a image with correct width and height, but it's a fully transparent image. How to make this action possible?
I successfully saved the file but its not an image file. No extension is shown. Its just a file with name download.
cannot claim offer
Hi,
I would like to know if is possible to save with your plugin an html element with many elements like:
<div id="tee-view">
<svg version="1.1" style="position:absolute; top: 10px; right: 50px;" id="Livello_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="595.28px" height="841.89px" viewBox="0 0 595.28 841.89" enable-background="new 0 0 595.28 841.89" xml:space="preserve">
</svg>
<div class="ui-wrapper">
<img src="/wp-content/uploads/editor/1420192958.jpg">
<div class="ui-resizable-handle ui-resizable-e" style="z-index: 1000;"></div>
</div>
</div>
I have tried with:
var svg = document.getElementById('tee-view');
svg = svg.innerHTML;
var canvas = document.createElement('canvas');
canvas.id = 'canvas';
document.body.appendChild(canvas);
canvg(document.getElementById('canvas'), svg);
Canvas2Image.saveAsPNG(canvas);
but returns to me an empty image
Hi, thanks for this wonderful script but i hit a problem. I am drawing other stuff to the canvas and i need to be able to update the canvas in frames. Currently all i see so far replaces the whole canvas. Have I got this wrong? Is there a default way to update the canvas rather than outright replace it or what can i do?
What is Wrong ?
all things are well but the images that is downloaded , is formatless and image viewers cant open them .
in your demo this problem exists too .
can you please solve this ?
Hi, I love this script but on my iPhone, I see the following error:
http://i.imgur.com/QVXSJAK.png
It seems that iOS can't download Data URLs.
Can you help?
when i delete the draw function "draw()", something wrong appears: the bmp/jpeg image saved is black, but the png image's result is right. Can someone helps me?
im not able to save or covert the image
used in php
Canvas2Image.saveAsPNG(canvas); does not save image as png, it just downloads the file without any extension but it download a excellent image including every css design
I'm seeing that when I do a save as it isn't setting a name or file extension. However I can still open the file as and image.
I know, a tag has a download
attr, but not expected browsers support this.
I checked the source and found @hongru uses location.href=data
to download, which makes the file name only be 'download'.
So, is there any way to change the name?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.