Code Monkey home page Code Monkey logo

canvas2image's People

Contributors

denvdmj avatar hongru avatar muffunkevin avatar yangfei4913438 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

canvas2image's Issues

Download not working in IE11

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 ?

Are you sure it can use?

no test
no extension name
even if the operation is too fast, reported error Canvas2Image is undefined

I get black picture when convert to bmp

I try to convert img to bmp format
but if not running this at the very beginning

context.fillStyle = '#ffffff';
context.fillRect(0, 0, canvasWidth,canvasHeight);

Then it will convert to one black picture

Downloading not working

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:,

Blank image on Safari iOS

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.

Captures only visible area of canvas

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?

the result image is a little blur, can use canvas.toBlob to improve it

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)
          });
    })
})

GitHub Pages 404

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 :)

canvas2image npm not working

After installing canvas2image npm. I am getting the following error:

TypeError: Canvas2Image.saveAsPNG is not a function

License?

Hi,

I would like to know under that license is distributed

Thanks,
Guillermo

No file extension

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;

Black image with Game Engines

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?

Save multiple elements

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

Update the canvas

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?

Image Downloads But FormatLess

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 ?

something wrong with bmp/jpeg?

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?

downloaded file does not have any extension

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

download name

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.

Is there any way to change the download file name?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.