I'm working on a canvas upload script to upload huge images for a client. I have everything working as needed, except one problem. HUGE images don't work. The goal is to be able to upload images of around 20000x20000.
Images of around 15000x15000 are working fine, but larger don't. It even isn't consistent in what the results are. Mostly they just turn black, but sometimes the browser just stops and gives the page that it stopped working.
var oc = document.createElement('canvas'), octx = oc.getContext('2d');
oc.width = img.width;
oc.height = img.height;
var iStep = .9;
while (oc.width * iStep > width) {
oc.width *= iStep;
oc.height *= iStep;
octx.drawImage(img, 0, 0, img.width, img.height, 0, 0, oc.width, oc.height);
console.log('Resized to: height: ' + oc.height + '; width: '+oc.width);
}
oc.width = width;
oc.height = oc.width * img.height / img.width;
octx.drawImage(img, 0, 0, oc.width, oc.height);
sDataString = oc.toDataURL("image/jpeg", .8);
// Followed by an ajax upload
The images that are uploaded are mostly artpieces of around 20k quality.
Do you guys/girls have any idea how I can solve the black images?