I am trying to crop an image based on background color in JavaScript. I have come up with the following code:
var d = ctx.getImageData(0, 0, 320, 240);