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 badges2 Answers
Reset to default 4You 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