Giter Club home page Giter Club logo

dom-to-image's Introduction

DOM to Image

Build Status

What is it

dom-to-image is a library which can turn arbitrary DOM node into a vector (SVG) or raster (PNG or JPEG) image, written in JavaScript. It's based on domvas by Paul Bakaus and has been completely rewritten, with some bugs fixed and some new features (like web font and image support) added.

Installation

NPM

npm install dom-to-image

Then load

/* in ES 6 */
import domtoimage from 'dom-to-image';
/* in ES 5 */
var domtoimage = require('dom-to-image');

Bower

bower install dom-to-image

Include either src/dom-to-image.js or dist/dom-to-image.min.js in your page and it will make the domtoimage variable available in the global scope.

<script src="path/to/dom-to-image.min.js" />
<script>
  domtoimage.toPng(node)
  //...
</script>

Usage

All the top level functions accept DOM node and rendering options, and return promises, which are fulfilled with corresponding data URLs.
Get a PNG image base64-encoded data URL and display right away:

var node = document.getElementById('my-node');

domtoimage.toPng(node)
    .then(function (dataUrl) {
        var img = new Image();
        img.src = dataUrl;
        document.body.appendChild(img);
    })
    .catch(function (error) {
        console.error('oops, something went wrong!', error);
    });

Get a PNG image blob and download it (using FileSaver, for example):

domtoimage.toBlob(document.getElementById('my-node'))
    .then(function (blob) {
        window.saveAs(blob, 'my-node.png');
    });

Save and download a compressed JPEG image:

domtoimage.toJpeg(document.getElementById('my-node'), { quality: 0.95 })
    .then(function (dataUrl) {
        var link = document.createElement('a');
        link.download = 'my-image-name.jpeg';
        link.href = dataUrl;
        link.click();
    });

Get an SVG data URL, but filter out all the <i> elements:

function filter (node) {
    return (node.tagName !== 'i');
}

domtoimage.toSvg(document.getElementById('my-node'), {filter: filter})
    .then(function (dataUrl) {
        /* do something */
    });

Get the raw pixel data as a Uint8Array with every 4 array elements representing the RGBA data of a pixel:

var node = document.getElementById('my-node');

domtoimage.toPixelData(node)
    .then(function (pixels) {
        for (var y = 0; y < node.scrollHeight; ++y) {
          for (var x = 0; x < node.scrollWidth; ++x) {
            pixelAtXYOffset = (4 * y * node.scrollHeight) + (4 * x);
            /* pixelAtXY is a Uint8Array[4] containing RGBA values of the pixel at (x, y) in the range 0..255 */
            pixelAtXY = pixels.slice(pixelAtXYOffset, pixelAtXYOffset + 4);
          }
        }
    });

All the functions under impl are not public API and are exposed only for unit testing.


Rendering options

filter

A function taking DOM node as argument. Should return true if passed node should be included in the output (excluding node means excluding it's children as well). Not called on the root node.

bgcolor

A string value for the background color, any valid CSS color value.

height, width

Height and width in pixels to be applied to node before rendering.

style

An object whose properties to be copied to node's style before rendering. You might want to check this reference for JavaScript names of CSS properties.

quality

A number between 0 and 1 indicating image quality (e.g. 0.92 => 92%) of the JPEG image. Defaults to 1.0 (100%)

cacheBust

Set to true to append the current time as a query string to URL requests to enable cache busting. Defaults to false

imagePlaceholder

A data URL for a placeholder image that will be used when fetching an image fails. Defaults to undefined and will throw an error on failed images

Browsers

It's tested on latest Chrome and Firefox (49 and 45 respectively at the time of writing), with Chrome performing significantly better on big DOM trees, possibly due to it's more performant SVG support, and the fact that it supports CSSStyleDeclaration.cssText property.

Internet Explorer is not (and will not be) supported, as it does not support SVG <foreignObject> tag

Safari is not supported, as it uses a stricter security model on <foreignObject> tag. Suggested workaround is to use toSvg and render on the server.`

Dependencies

Source

Only standard lib is currently used, but make sure your browser supports:

Tests

Most importantly, tests depend on:

  • js-imagediff, to compare rendered and control images

  • ocrad.js, for the parts when you can't compare images (due to the browser rendering differences) and just have to test whether the text is rendered

How it works

There might some day exist (or maybe already exists?) a simple and standard way of exporting parts of the HTML to image (and then this script can only serve as an evidence of all the hoops I had to jump through in order to get such obvious thing done) but I haven't found one so far.

This library uses a feature of SVG that allows having arbitrary HTML content inside of the <foreignObject> tag. So, in order to render that DOM node for you, following steps are taken:

  1. Clone the original DOM node recursively

  2. Compute the style for the node and each sub-node and copy it to corresponding clone

    • and don't forget to recreate pseudo-elements, as they are not cloned in any way, of course
  3. Embed web fonts

    • find all the @font-face declarations that might represent web fonts

    • parse file URLs, download corresponding files

    • base64-encode and inline content as data: URLs

    • concatenate all the processed CSS rules and put them into one <style> element, then attach it to the clone

  4. Embed images

    • embed image URLs in <img> elements

    • inline images used in background CSS property, in a fashion similar to fonts

  5. Serialize the cloned node to XML

  6. Wrap XML into the <foreignObject> tag, then into the SVG, then make it a data URL

  7. Optionally, to get PNG content or raw pixel data as a Uint8Array, create an Image element with the SVG as a source, and render it on an off-screen canvas, that you have also created, then read the content from the canvas

  8. Done!

Things to watch out for

  • if the DOM node you want to render includes a <canvas> element with something drawn on it, it should be handled fine, unless the canvas is tainted - in this case rendering will rather not succeed.

  • at the time of writing, Firefox has a problem with some external stylesheets (see issue #13). In such case, the error will be caught and logged.

Authors

Anatolii Saienko, Paul Bakaus (original idea)

License

MIT

dom-to-image's People

Contributors

andystanton avatar cnatis avatar denis-sokolov avatar mrharel avatar pbakaus avatar stebogit avatar tclausing avatar tsayen avatar ulikoehler avatar willemmulder 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  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

dom-to-image's Issues

Optimize downloading webfonts

Hello ,

I am having lots of fonts in my app and while generating png image there are many ajax calls for getting these font files from the server. As i need to support many browsers hence there are font's in different formats and right now for a single image to be generated from DOM, the count for fetching fonts goes above 100.

Due to browser trying to fetch so many fonts, it freezes for a while when generating image. Is there any way by which i can reduce these downloads or supply those fonts in some way so that we need not tell browser to fetch it exclusively again as they are already fetched ?

Image size should crop for content clipped by overflow:hidden;

Child element is larger than parent, but is not shown because parent has "overflow:hidden;" property.

Rendering parent element to image should produce an image the size of the parent, but is larger because of it's clipped children. The extra space is transparent for toPng(), and is black for toJpeg().

https://jsfiddle.net/yd6kkgqw/1/

Found in Chrome (Version 52.0.2743.82 m)
Verified in Firefox (Version 47.0.1)

The suggestion about js file

Hello @tsayen ,
I am the member of cdnjs project.
We want to host this library.
But there are different naming in src and dist file in version 0.0.1~0.0.5.(domvas.js)
What's your suggestion about changing the name from domvas to dom-to-image or keeping the same naming.
Thanks for your help!

cdnjs/cdnjs#8589
cdnjs/cdnjs#8701

'Promise' is undefined

I get a 'Promise' is undefined error on : dom-to-image.min.js, Line: 5, Column: 9
the line : return b = b || {}, Promise.resolve(a).then(function(a) {

When running on IE 11.0.9600.18204 on Windows 7 x64

Use in nodejs

Thanks so much for the awesome code! I'm building an Electron app - electron.atom.io - and need to create a series of png images of a specific div's contents, saving each frame of animation. I'm using the following script:

// domtoimg test
var stageContainer = document.getElementById('stage-container');
domtoimage.toPng(stageContainer)
.then(function (dataUrl) {
    fs.writeFileSync('./tmp/pngs/img'+padded+'.png', dataUrl);
})
.catch(function (error) {
    console.error('oops, something went wrong!', error);
});

Files are saving but I am getting files that are unreadable as PNGs. They're coming out like this..

newimg0001

Is this something I'm doing or a bug?

Safari Support

I got Event error when I run it on Safari 8.0.7

OOOOOOOPS, something went wrong! 
Event
bubbles: false
cancelBubble: false
cancelable: false
clipboardData: undefined
currentTarget: null
defaultPrevented: false
eventPhase: 0
returnValue: true
srcElement: null
target: null
timeStamp: 1459283334222
type: "error"
__proto__: EventPrototype

the function I ran is like the following

function () {
      domtoimage.toPng(document.querySelector('body'))
        .then(function (dataUrl) {
          var img = new Image();
          img.src = dataUrl;
          document.body.appendChild(img);
        })
        .catch(function (error) {
          console.error('OOOOOOOOPS, something went wrong!', error);
        });
    }

Something wrong with the example in README.md

In the README.md, there is one line document.appendChild(img);. This will be an error in Chrome saying that "Failed to execute 'appendChild' on 'Node': Only one element on document allowed.".

IE11 support, and hard to trace error when exception happens

I got this message when I test on windows

image

From the message above, I have no clue which line gave that error message.

The function I ran was

function () {
      domtoimage.toPng(document.querySelector('body'))
        .then(function (dataUrl) {
          var img = new Image();
          img.src = dataUrl;
          document.body.appendChild(img);
        })
        .catch(function (error) {
          console.error('OOOOOOOOPS, something went wrong!', error);
        });
    }

Is there any error tracing method in your application?

In Firefox getCssRules fails for external stylesheets

In firefox (41.0.2) getCssRules fails for stylesheets from external domains.

SecurityError: The operation is insecure.
util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));

In particular it failed on such link:

<link href="//fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600" rel="stylesheet">

textarea height displayed incorrectly in SVG

Hi there, first off, great library! This is helping find a solution to printing headers in Google Chrome that no one has seemed to be able to do easily and effectively.

The issue I have with the library is the height of a rendered textarea in SVG. If I have a textarea filled with text with a certain height set with an inline-style, looking at the SVG the textarea height is different. The heights I have been getting in the SVG are significantly taller than the true height of the textarea when passed into domtoimage.

When specifying filter option, get error in embedFonts

Hi, first of all, thanks for making this library public. You are a saint.

Testing on Chrome 49.0.2623.87 (64-bit) / Mac. My document has embedded fonts ( Google Fonts )
I'm having a problem when specifying filter function to .toSvg - it fails when encounters a filtered out node.

var filterFunc = function( node ) {
    if ( node.id == 'background' ) return true;
    return false;
};

domtoimage.toSvg( container, { filter: filterFunc } )
                        .then( domtoimage.impl.util.makeImage )
                        .then( domtoimage.impl.util.delay( 100 ) )
                        .then( drawToCanvas )
                        .catch( function ( error ) { console.error( error ); } );

It fails / dies with the following error:

dom-to-image.js:198 Uncaught (in promise) TypeError: Cannot read property 'appendChild' of undefined
    at dom-to-image.js:198:21
(anonymous function) @ dom-to-image.js:198
Promise.resolve (async)readAll @ dom-to-image.js:516
resolveAll @ dom-to-image.js:501
embedFonts @ dom-to-image.js:195
Promise.resolve (async)toSvg @ dom-to-image.js:32

On line 198 inside embedFonts, node is undefined. Because of all the Promises, I'm having a hard time actually debugging this. Do you have any ideas what could be causing this?

Node with Image output image with borders

First , Thanks for create such awesome library ๐Ÿ‘ฏ

I have found a bug when using it with a dom that contains a image (a border is added although it doesn't have a border property)

asd

Thanks :D

error converting html to png

asArray function throws error when arrayLike is null.
I've managed to patch it by simply adding check and returning empty array as a result.

3 pixel padding rendered below SVG (Chrome).

Update: Appears to be a Chrome Bug, see comment.

In testing the library, I found the resultant image was larger than the dom element I was trying to capture.

There appears to be 3 extra pixels of height rendered below SVG elements. I've found the simplest case that illustrates: [https://jsfiddle.net/8kx0una9/]

A 100x100 pixel div, containing a 100x100 pixel SVG containing a 100x100 pixel path element.
Chrome inspector verifies all three elements rendered as 100x100 px (Version 52.0.2743.82 m)
Firefox (Version 47.0.1) produces a 100x100px image, as expected.

toPng() creates a png of the div at 100x103, with the extra 100x3 pixels as transparent.
toJpeg() creates a jpeg of the div at 100x103, with the extra 100x3 pixels as black.

Various Observations:

  • 3 pixels seems to be a fixed amount. 100x100 renders as 100x103, 400x400 renders as 400x403.
  • 3 px is from the bottom of the SVG. If the SVG ends 2 pixels above the bottom of the div, 1 extra pixel of height is added.
  • toPng() renders a 3px transparent bar (even if a Bgcolor is set)
  • toJpeg() renders a 3px black bar (even if a Bgcolor is set)
  • Add padding left and right, and use {Bgcolor:"#FF0000"}: Red padding added left and right, the 3px extra height renders as transparent or black for the full width, not just below the SVG.
  • Found a separate issue while testing this one, Image size should crop for content clipped by overflow:hidden;, The overflow issue also appears in Firefox, but these 3 pixels do not.
  • Setting overflow:hidden; does not relieve the problem, but appears to increase the extra padding to 4px.

In the above fiddle, I could not get toPng() or toJpeg() to successfully render the SVG element directly (I don't know if that would be a separate bug, or a feature request).

Thanks for the work, btw... this looks almost perfect for my needs.

<img> always gives error status 201 if the src image url has parameters in it

The toolkit I'm using appends a jsessionid parameter to urls in order to distinguish the sessionid of the user. Which also means, when it generates an image, I end up with a dom element like this:

<img src="data/assets/image/121.jpg;jsessionid=8153D72A2FAA17F121E90D303763A947"/>

and when I try to take a screenshot of the area I'm interested into, it will always fail for the reason above,
even if I have access to that image from the browser (and indeed if I copy the url into a new tab, I can see the image), and the dom-to-image script is of course served from the same domain as the image (oh well, it's all running locally on my pc :-) ).

Library not loaded in mobile Safari

Hello. I'm trying to use domtoimage in Mobile Safari.

The library is not loaded and no error is apparent. I added an alert at the beginning of the script and it does not show. If I remove all the content of the script the alert shows.

I will investigate the issue but I was wondering if the library had been tested on safari.

Feature - Export SVGImageElement

Hi,
Not an issue but a wish-feature.
Would be nice to be able to export SVGImageElement's as well as HTMLImageElement.

Been trying a workaround, but code gets me bit stuck. Will notify if we get to something.

Feature - Watermark

Hiya,

Any chances of having some rendering options in order to add a watermark to the resulting image?

Error: SecurityError: DOM Exception 18

Error: SecurityError: DOM Exception 18

I seem to be getting this error only in Safari when I try to save a node. The node is a div with a fixed height and width, but with nothing in it.

OS X El Capitan 10.11.5 (15F34)
Safari Version 9.1.1 (11601.6.17)

Problem with loading fonts

I have this lines in my css

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url(../fonts/glyphicons-halflings-regular.eot);
  src: url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'), url(../fonts/glyphicons-halflings-regular.woff) format('woff'), url(.spd-editor-.spd-editor-/fonts/glyphicons-halflings-regular.ttf) format('truetype'), url(.spd-editor-.spd-editor-/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg');
}

but dom-to-image trying to get it by this url

http://localhost:9000/styles/.spd-editor-.spd-editor-/fonts/glyphicons-halflings-regular.ttf

Tests are failing

Just tried to run test, as I want to contribute to this but there was a failture=(

Start:
  domtoimage
    โœ” should load
INFO [Chrome 44.0.2403 (Mac OS X 10.10.4)]: Connected on socket LE5Fu9zSDlAM0HjSGFaS with id 31881270
    โœ– should render simple node
    โœ– should render big node
    โœ– should handle "#" in colors and attributes
    โœ– should render nested svg with broken namespace
    โœ– should render correctly when the node is bigger than container
    โœ– should render nested text nodes
    โœ– should render to blob
    โœ– should use node filter

Finished in 1 min 28.216 secs / 1 min 28.049 secs

SUMMARY:
โœ” 2 tests completed
โœ– 16 tests failed

FAILED TESTS:
  domtoimage
    โœ– should render simple node
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

    โœ– should render big node
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 30000ms exceeded. Ensure the done() callback is being called in this test.

    โœ– should handle "#" in colors and attributes
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

    โœ– should render nested svg with broken namespace
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

    โœ– should render correctly when the node is bigger than container
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

    โœ– should render nested text nodes
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

    โœ– should render to blob
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

    โœ– should use node filter
      Firefox 38.0.0 (Mac OS X 10.10.0)
      Chrome 44.0.2403 (Mac OS X 10.10.4)
    Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

Warning: Task "karma:unit" failed. Use --force to continue.

I had really difficult times with node-canvas and cairo, did you install it without any problems?
Currently npm i node-canvas -g
return


> [email protected] install /usr/local/lib/node_modules/canvas
> node-gyp rebuild

  SOLINK_MODULE(target) Release/canvas-postbuild.node
  SOLINK_MODULE(target) Release/canvas-postbuild.node: Finished
  CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:7:
../src/Canvas.h:22:10: fatal error: 'nan.h' file not found

Capturing vertical half image on Chrome Browser

Issue

Promise is Undefined

on Safari Browser (version [5.1.7)

Capturing vertical half image on Chrome Browser (version 49.0.2623.112)

var mainDiv = document.getElementById('mainDiv');
var canvas = document.createElement('canvas');
canvas.width = mainDiv.scrollWidth;
canvas.height = mainDiv.scrollHeight;

domtoimage.toPng(mainDiv).then(function (pngDataUrl) {
console.log(pngDataUrl);
}).catch(function (error) {
console.log("OOPS, something went wrong!.");
});

Perfect working on Mozila Browser

I did not get full image on chrome browser
Displaying White Space below portion

report_14622551420011

How to use on server? Node.js

This is dependent on document how can this be updated to work in a server environment? Would it beable to handle a HTML String?

error in trying to capture body

I have just downloaded the library.
I am hosting it on an apache server I have installed on my machine.
I am injecting the javascript to a given via the console
var url='https://guest.supporttip.com/static/tipcms/js/dom-to-image.min.js';var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=url;head.appendChild(script);

and then I try to run the code from the readme:

var node = document.body;

domtoimage.toPng(node)
    .then(function (dataUrl) {
        var img = new Image();
        img.src = dataUrl;
        document.body.appendChild(img);
    })
    .catch(function (error) {
        console.error('oops, something went wrong!', error);
    });

I have tried this with several pages and it fails more often than not. Can someone assist?

Google Fonts

Hi,

May be its issue OR not
but i have some fonts added from google URL within my web page and when i do get dom to image it didn't render actual font faces which are getting render on web page from google URL.

please let me know if you can help.

Regards
Usman Abdul Razzaq

Printing node not currently attached to DOM

I have got your excellent module working when I am printing an element found by its Id (as per your documentation) however I have a requirement to print HTML provided to me by an external service.

My attempt currently looks like this:

    var fromHtml = function (html) {
        var promise = $q(function(resolve, reject) {
            var node = document.createElement('div');
            node.innerHTML = html;

            domtoimage.toPng(node)
            .then(function (dataUrl) {
                // Trim meta information
                var trimmed = dataUrl.replace('data:image/png;base64,', '');
                resolve(trimmed);
            })
            .catch(function (e) {
                reject('Error converting HTML to canvas for printing: ' + e);
            });
        });

        return promise;
    };

The behaviour I am seeing is... nothing happens; it doesn't even hit my "catch".

I've had a look through the code and can't see anything obvious requiring the html passed into the .toPng(...) function be attached to the DOM however if I embed the HTML in my DOM and pass an Id as your docs it does work?

Have you got any ideas on this? I cannot easily embed the HTML into the DOM for every case.

Remote Images

Hi

I've just started to use this library - very helpful.

Rendering dom with some remote image sources in it. Getting:

`XMLHttpRequest cannot load https://{bucket}.s3.amazonaws.com/uploads/North_face.jpg. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '{me}' is therefore not allowed access.

I've checked the CORS settings on my bucket. All OK.

Curl from the same terminal, 200 OK.

Not quite sure where to go now. Where in the code do you set the request headers? Maybe that's where I'll start.

Thanks

Tom

Specify output image dimensions

It would be extremely useful to be able to optionally specify the dimensions for the output image and have the image rendered at a higher resolution than the DOM element itself.

This would have numerous uses but would be particularly useful for printing the image afterwards. Printing at 72dpi (screen resolution) is not advisable!

One simple idea for making this happen is to scale the DOM element before rendering using the CSS *_zoom *_property or the CSS *_transform *_property. I attempted this but the bounding box for the element seems to remain the same, so while the elements do render larger, as expected, the image itself is cropped to the original size of the element, cutting out the bottom and right part of the element.

'canvas' is not saved

If there are 'canvas' element under the node, the 'canvas' element is not saved(or saved with blank), should clone the canvas as a image and save it.

Future plans?

Hi, I noticed that you only active contributor of domvas, and looks like this project the only solution for the transformation dom to the image, so this seems to me surprising that it have not got bigger support. Do you have some plans for this? As I see @pbakaus is no longer support this. Did you contact with him?

render images

looks like the same approach as with fonts should be taken

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.