This is part of my code that uploads the image file. I have only shown the portion where I update the image variable as well as the CamanJS instance:
updateImage() {
img = new Image();
img.src = reader.result;
img.onload = function () {
Caman('#canvas', img, function () {
this.reloadCanvasData();
});
}
}, false);
This is the code where I apply the filters:
$("button").on('click', function (e) {
Caman('#canvas', img, function () {
this.revert(false);
});
Caman('#canvas', img, function () {
Apply the filters here.
this.render();
});
});
If I load an image and apply a filter, it works. If I load another image, it shows up in the canvas but applying filters after that changes my canvas to the first image. Is there anything that I can do to update the CamanJS data?