I am trying to fix problem when cropping images using canvas and drawImage. I've gone through all articles in internet and couldn't find simple answer or help.
The script actually works, but the cropped images are full with noise. I would appreciate your help and ideas that will lead to fixing this.
I am using firefox(27.0.1) when i am working with these functions.
$(document).ready(function() {
var width = 80, height = 80;
var ctx = document.getElementById('canvas').getContext('2d'),
img = new Image,
w = 200,
h = 200,
x = 800,
y = 100;
img.src = $('#image2').attr('src');
ctx.drawImage(img, x, y, w, h, 0, 0, width, height);
});
Fiddle example of how it looks after crop:
Example of how i see it (and how i want it to look) and how it becomes after: