I am making an app which will convert users uploaded image to black and white and then return a `base64` string of image

Like:

`<input type="file" onchange="handleFiles(this.file)" />`

function handleFiles(f)
{
 var o=[];

```
for(var i =0;i<f.length;i++)
{
    var reader = new FileReader();
    reader.onload = (function(theFile) {
    return function(e) {
        gCtx.clearRect(0, 0, gCanvas.width, gCanvas.height);
        //i want e.target.result to have base64 of black and white image not colorful image.
        //My processing with e.target.result image
    };
    })(f[i]);
    reader.readAsDataURL(f[i]); 
}

```

}

`e.target.result` contains colordful image base 64 string
i want `e.target.result` to have black and white base 64 string