简体   繁体   English

应用图片过滤器

[英]Apply image filter

I want to use some of the fabric image filters, but when i apply a filter the image disappears. 我想使用一些织物图像滤镜,但是当我应用滤镜时,图像消失了。 Acutally it´s just the code from the tutorial http://fabricjs.com/fabric-intro-part-2/ . 基本上,这只是教程http://fabricjs.com/fabric-intro-part-2/中的代码。

var canvas = new fabric.Canvas('c');
fabric.Image.fromURL('http://applyfilters.fm/wp-content/uploads/2014/07/IMG_0289-e1405013078402.jpg', function(img) {
img.scale(0.5);
img.filters.push(new fabric.Image.filters.Grayscale());
img.applyFilters(canvas.renderAll.bind(canvas));
canvas.add(img);
});

Please be so kind to inform me what my stupid and likely trivial mistake is. 请告诉我我的愚蠢且可能是微不足道的错误是什么。

Thanks in advance 提前致谢

Sorry, I have less reputation, I cannot make comment. 抱歉,我的信誉较差,无法发表评论。

At the tutorial, the image is in same host. 在本教程中,映像位于同一主机中。 How about using test.jpg , not http://applyfilters.fm/wp-content/uploads/2014/07/IMG_0289-e1405013078402.jpg ? 如何使用test.jpg而不是http://applyfilters.fm/wp-content/uploads/2014/07/IMG_0289-e1405013078402.jpg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM