todataurl

Reconstruct original 16-bit Raw pixel data from the HTML5 canvas

非 Y 不嫁゛ 提交于 2019-12-24 08:48:36
问题 If a 16-bit single channel (Gray-scale) raw pixel data losslessly encoded into Image format(e.g.PNG, Webp , Jpeg-2000 or JPEG-XR) and Image rendered to HTML5 canvas, then is there any way to retrieve original 16-bit Raw pixel data from the canvas? 回答1: No. When drawn to a canvas the image is uncompressed, and all the pixels data are pre-multiplied and converted to 24-bit data + an 8-bit alpha channel (RGBA). In this process the image looses everything from the original, even for same color

html2canvas and toDataURL generated image has horizontal line

房东的猫 提交于 2019-12-23 16:08:24
问题 I am looping through 10-14 html elements, and generating image data in an array for later use for insertion into a PDF. The problem is that these images occasionally have a horizontal line across them, which seems seems to be an existing issue with html2canvas. Happens mostly in FF and IE, and occationally on Chrome, but not as often. function convertElementsToImages(containerSelector) { if (_this.pdfDebug) { window.console.log('convertElementsToImages'); window.console.log(containerSelector)

How do I set crossOrigin attribute when using canvas.toDataURL?

旧巷老猫 提交于 2019-12-23 10:20:05
问题 So I'm trying to create a print map function for an OpenLayers 3 application I'm building. I'm aware of their example but whenever I attempt to use it I run into the dreaded tainted canvas issue. I've read the whole internet and come across folks saying first to set CORS correctly (done and done) but also to do: var img = new Image(); img.setAttribute('crossOrigin', 'anonymous'); img.src = url; The above is described here. My question is, I've never really used toDataURL() before and I'm not

Convert dynamic SVG to downloadable PNG in IE

大兔子大兔子 提交于 2019-12-22 08:35:10
问题 Goal - using the client-side: Convert a dynamic SVG drawing ( created using d3js ) to a downloadable PNG image and works using Internet Explorer. Accomplished: Achieved in Chrome, no problem. Once I have the PNG DataURI it is easily converted to a downloadable PNG blob. Unfortunately in IE running the same code produces a SecurityException, it fails when I try to convert the canvas to the PNG DataURI ( canvas.toDataURL ). Apparently this is an active IE BUG and I've found others on

Merge Multiple Canvases and Download as Image

大憨熊 提交于 2019-12-22 00:09:52
问题 I'm attempting to merge two HTML canvases into a single canvas and then download that as an image. My code is as below: function downloadCanvas() { var bottleCanvas = document.getElementById('bottleCanvas'); var designCanvas = document.getElementById('editorCanvas'); var bottleContext = bottleCanvas.getContext('2d'); bottleContext.drawImage(designCanvas, 69, 50); var dataURL = bottleCanvas.toDataURL("image/png"); var link = document.createElement('a'); link.download = "bottle-design.png";

Canvas toDataURL() returns blank image

烈酒焚心 提交于 2019-12-20 07:51:27
问题 I'm using glfx.js to edit my image but when I'm trying to get that image's data using the toDataURL() function I get a blank image (width the same size as the original image). The strange thing is that in Chrome the script works perfect. What I want to mention is that the image is loaded in canvas using the onload event: img.onload = function(){ try { canvas = fx.canvas(); } catch (e) { alert(e); return; } // convert the image to a texture texture = canvas.texture(img); // draw and update

Saving canvas with CanvasRenderingContext2D filter

隐身守侯 提交于 2019-12-17 20:41:02
问题 I have the problem with saving photo with CanvasRenderingContext2D.filter. When I connect to video and try to take a shot without any filters, it saves normally. However, after adding some filters to canvas, it is saving as HTM file or return previous photo without filters if it was made. The weird is, that while downloading that screenshot manually by clicking on it, it does have own toDataUrl, downloads normally and contains filter but while saving it using toDataUrl, it still doesn't see

How to convert array of png image data into video file

我只是一个虾纸丫 提交于 2019-12-17 09:52:32
问题 I am getting frames from canvas through canvas.getDataURL() . However, now I have an array of png images, but I want a video file. How do I do this? var canvas = document.getElementById("mycanvaselementforvideocapturing"); var pngimages = []; ... setInterval(function(){pngimages.push(canvas.toDataURL())}, 1000); 回答1: For a full browser support way, you'll have to send your image batch to the server then use some server-side program to do the encoding. FFmpeg might be able to do it. But in

html2canvas Chart.js chart not rendered

无人久伴 提交于 2019-12-13 03:30:26
问题 I am trying to export a div that contains a Chart.js chart as an Iamge. All elements are displayed perfectly fine, however, the Chart.js canvas just doesn't get rendered. I am calling my export function in the callback of the onAnimationComplete option in my chart, so the export can't happen before the chart is fully built. Here is how my html2canvas and download functions look: download() { this.dl.download = this.fileName; this.dl.click(); } loadDataUrl($node) { this.hideUnwantedElements();

How to implement -toDataURL() function in node.js server?

試著忘記壹切 提交于 2019-12-08 13:09:20
问题 I am a newbie using webgl implementation as a dependent module for my project. I am trying to use .toDataURL() function using node-webgl wrapper at server side. But I get an error station .toDataURL() is undefined. For more detail, please have a look at this link: canvas.toDataURL() is not a function - error node-webGL wrapper Well the current post is definitely not a duplicate. In the post(earlier link shared) I am trying to find an alternative way to access the data of canvas. The goal of