// tell it to scale image
//context.scale(scaleToRatioh, scaleToRatiow);
// draw image to canvas
context.drawImage(imageElement, sx, sy, sw, sh, dx, dy, cw, ch);
// get image data
//double w = dw * scaleToRatioh;
//double h = dh * scaleToRatiow;
ImageData imageData = context.getImageData(0, 0, cw, ch);