小编Gam*_*Tag的帖子

具有CSS类的img的DataURL

<img>感谢CSS类,我必须应用一些样式.

是否有可能得到dataURL<img>与CSS样式?

$(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());
})
Run Code Online (Sandbox Code Playgroud)
.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) …
Run Code Online (Sandbox Code Playgroud)

html javascript css image fabricjs

7
推荐指数
1
解决办法
410
查看次数

标签 统计

css ×1

fabricjs ×1

html ×1

image ×1

javascript ×1