Posts

Showing posts with the label fabricjs

DataURL of an img with CSS class

Image
DataURL of an img with CSS class I have to apply some styles on <img> thanks to a CSS class. <img> Is it possible to get the dataURL of the <img> with the CSS style ? dataURL <img> $(function() { // Original const imgOriginal = document.getElementById('original'); const c1 = document.getElementById('c1'); let ctx = c1.getContext('2d'); ctx.drawImage(imgOriginal, 100, 100); // Filtered const imgFiltered = document.getElementById('filtered'); const c2 = document.getElementById('c2'); ctx = c2.getContext('2d'); ctx.drawImage(imgFiltered, 100, 100); // Same dataURL :( console.log(c1.toDataURL(), c2.toDataURL()); console.log(c1.toDataURL() === c2.toDataURL()); }) .filter::before { display: block; height: 100%; left: 0; position: absolute; top: 0; width: 100%; z-index: 1; border: 1px solid red; } .filter { position: relative; -webkit-filter: sepia(.5) hue-rotate(-30deg) sa...