Reputation: 11
I am using CamanJS to create a photo editing app with filters. I have it working perfectly but after the user uploads an image then goes through the process of uploading another one as soon as they apply any filter it reverts the canvas back to the previously uploaded image. I am using the revert() function but I am also reassigning the canvas to the newly uploaded image but it still reverts back to the first image. So my question is, is there a way to totally clear the canvas/camanJS revert memory to the point where camanJS revert() will not revert to the previous image?
One of my filters:
function vintage(){
Caman("#myFilterCanvas", function () {
this.revert();
this.greyscale();
this.contrast(5);
this.noise(3);
this.sepia(100);
this.channels({
red: 8,
blue: 2,
green: 4
});
this.gamma(0.87);
this.vignette("40%", 30);
this.render();
});
}
Upvotes: 0
Views: 1708
Reputation: 41
Try with below,
this.revert(false);
this[effect]();
this.render();
or
Could you please share some code in JSfiddle.
Upvotes: 1