meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation

Home Page:http://camanjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

this.sharpen is not a function

bumblebeehub opened this issue · comments

Hi, I include CamanJs using this:
<script src="../../node_modules/caman/dist/caman.full.min.js"></script>
<script src="../../node_modules/caman/dist/caman.js"></script>.
and use sharpen like this:
this.sharpen(15)
But I still got this error:

this.sharpen is not a function

Why?

You can create a single sharpen filter using

Caman.Filter.register("sharpen", function () {
  this.processKernel("Sharpen", [
    0, -1, 0,
    -1, 5, -1,
    0, -1, 0
  ]);
});

Unfortunately, you will need to fine tune the sharpening process by playing around with the constant 5. The closer to 4 it gets, the sharper the image gets, and the farther away, towards infinity, you get a blurring effect. You can find more info at https://www.html5rocks.com/en/tutorials/canvas/imagefilters/