How to change the sharpness and make a photo black and white using JavaScript?
I have designed a basic webpage in HTML which is basically web ap开发者_StackOverflow中文版p to edit the photos online.
Now I am unable to code the program as to how the colour sharpness brightness blurness, making a photo black and white and others haven't been possible.
How do we use HTML and JavaScript to make this work online?
You can do this using <canvas>
:
https://developer.mozilla.org/en/Canvas_tutorial
Draw image on
<canvas>
using JavascriptCanvas gives raw pixel access. Run filtering code written in Javascript. Example: http://blog.nihilogic.dk/2008/03/jsimagefx-javascript-image-effects.html
You can use
<canvas>
in a similar manner in HTML code as<img>
- both are basically pixel buffers
Note that you cannot access pixel data of images loaded from different origin.
精彩评论