jQuery.BlackAndWhite icon indicating copy to clipboard operation
jQuery.BlackAndWhite copied to clipboard

BnWWorker.js:4 Uncaught TypeError: Cannot read property 'data' of undefined at onmessage

Open maschad96 opened this issue 7 years ago • 0 comments

	var imagedata = event.data.imgData,
		intensity = event.data.intensity,
		px = imagedata.data, // The line throwing the error. Could you help address this?
		grey = null,
		length = px.length;

	for (var i = 0; i < length; i += 4) {
		var k = px[i] * 0.3 + px[i + 1] * 0.59 + px[i + 2] * 0.11;
		px[i] = ~~ (k * intensity + px[i] * (1 - intensity));
		px[i + 1] = ~~ (k * intensity + px[i + 1] * (1 - intensity));
		px[i + 2] = ~~ (k * intensity + px[i + 2] * (1 - intensity));
	}

	postMessage(imagedata);

};

maschad96 avatar May 16 '17 19:05 maschad96