最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - In fabric js, how to get the original image source from image object - Stack Overflow

programmeradmin0浏览0评论

In fabric js, I am trying to get the original source of an image, when I use the getElement() and getSrc() methods it shows the correct output, but after applying some image filters the same methods return the new image src (encoded image data) not the original image source.how can I get the original image source after applying the image filters.

In fabric js, I am trying to get the original source of an image, when I use the getElement() and getSrc() methods it shows the correct output, but after applying some image filters the same methods return the new image src (encoded image data) not the original image source.how can I get the original image source after applying the image filters.

Share Improve this question asked Sep 16, 2014 at 8:30 AshokbharathiAshokbharathi 1461 silver badge11 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

You can get the source of original image by accessing the fabric.object methods.

// Assuming your image object is selected. 
var object = canvas.getActiveObject(); 

var originalSource = object._originalElement.currentSrc;

will give you the original image source.

You can use getSrc() method:

var someUrlOrDataUrl = image.getSrc();

Docs: http://fabricjs./docs/fabric.Image.html#getSrc

发布评论

评论列表(0)

  1. 暂无评论