meltingice / CamanJS

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

Sharpen filter adds transparancy lines #220

Open Andrej64 opened 7 years ago

Andrej64 commented 7 years ago

When i use the sharpen filter on the canvas it adds on top and bottom a transparancy line. Saving as png the lines are clearly visible. Is this normal?

thanks.

Esc4pism commented 7 years ago

i had the same issue and was able to solve it by changing a small thing in the Renderer.prototype.renderKernel - function

i switched out the Math.max and Math.min respectively on these 2 lines:

start = Math.max(start, this.c.dimensions.width 4 ((adjustSize - 1) / 2)); end = Math.min(end, n - (this.c.dimensions.width 4 ((adjustSize - 1) / 2)));

to:

start = Math.min(start, this.c.dimensions.width 4 ((adjustSize - 1) / 2)); end = Math.max(end, n - (this.c.dimensions.width 4 ((adjustSize - 1) / 2)));

BenQuirk commented 6 years ago

I'm having the same issue. Depending on the level of sharpness, it renders a transparent line at just the bottom of the image or the top and bottom.

I tried the fix from Esc4pism - it worked to remove the transparent line at the top of the image but there's still a transparent line at the bottom.

I tried editing the level of sharpness but that did not change the issue.

Still looking for a solution.

LeParadoxHD commented 5 years ago

Same here, when using the sharpness filter with a value greater than 0 gives some transparent block at the bottom of the result image. Please fix it.

bumblebeehub commented 5 years ago

I can't use the sharpen function, can anyone help me? Each time I use this.sharpen(5), I get an error this.sharpen is not a function. Thanks in advance.