I will close the question as there is no solution, HTML/Javascript does not handle really large image, so I switched to Python + OpenCV.