Live data from Hacker News

Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

github.com

31–40 of 45 posts

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#31

Image in the readme would really be helpful. In fact anytime there is a visual output it makes sense to put an image. Thanks for creating this though - Will give it a try for an upcoming project.

Thank you for the suggestion!

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#32
post #4

How does this compare to something like the the Media Capture API? Looks like this uses `canvas.toDataURL()` which can be slow to serialize compared to `toBlob` or `canvas.captureStream(0).getVideoTracks()` I've been using CropTarget.fromElement with a CaptureController: https://gist.github.com/akre54/e93ab2ce27999aecb109e38085f2e...

Looks cool, somebody should make a package that puts a nice API around it. However seems that those APIs are only in Chrome now, not Firefox or Safari.

I tested it on Chrome, Firefox and Safari

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#33
post #22

I’ve been writing a browser extension recently, and part of the functionality I want is to export part of a view as an image, shareable for the socials. I wanted to use html2canvas, but the docs explicitly advise against using it in a browser extension. Would snapDOM be suitable for inclusion in an extension?

[deleted]

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#35
post #19

Earlier quoted context omitted.

Looks cool, somebody should make a package that puts a nice API around it. However seems that those APIs are only in Chrome now, not Firefox or Safari.

IMO it's simple enough to just write directly without library code. For most cases, the Element Capture or Region Capture API should be sufficient: https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capt... Demos: https://mdn.github.io/dom-examples/screen-capture-api/elemen... https://mdn.github.io/dom-examples/screen-capture-api/region... If you need cross-browser compatibility (and can't just use a canvas) the…

idk, your code is 170 lines, html2canvas and similar are 1 line to use.

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#36
It doesnt load, snapdom dont appear in my devtools had to copy paste script

Plus it just struck at pending promise dont work

Plus css is messed up, i cant call it a snapshot, if it dont look same

domtoimage lib works for me and is fast whole html body node captured within second

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#37
post #34

Tiny feature request: snapdom.toJpg(el) appears to return a JPEG image where the background color for any transparent areas is set to black - it would be useful to be able to set that to another color (I needed it to be white).

No problem! May you open an issue on the repo?

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#38
post #34

Tiny feature request: snapdom.toJpg(el) appears to return a JPEG image where the background color for any transparent areas is set to black - it would be useful to be able to set that to another color (I needed it to be white).

No problem! May you open an issue on the repo?

https://github.com/zumerlab/snapdom/issues/2

Re: Show HN: I created snapDOM to capture DOM nodes as images with exceptional speed

#39
post #22

I’ve been writing a browser extension recently, and part of the functionality I want is to export part of a view as an image, shareable for the socials. I wanted to use html2canvas, but the docs explicitly advise against using it in a browser extension. Would snapDOM be suitable for inclusion in an extension?

Firefox has screenshot that auto-picks elements, or you can click and drag a crop, or you can save the whole page. That and ad nauseam are the reason I use firefox; that singlefile also works is great (single html file dump of a web page, somehow).
Post reply on HN