meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

this.sharpen is not a function #234

Open bumblebeehub opened 5 years ago

bumblebeehub commented 5 years ago

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?

boulderwebdev commented 4 years ago

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/