我将OpenSeadragon用于深度缩放图像,并将openseadragonselection用于选择图像的特定部分并将其复制到新的画布中。但是这些模块似乎提供了与所附图像相同的图像。 Selection和 Copying to new canvas。 我正在使用的代码如下:
onSelection: function(rect) {
viewer.viewport.goHome();
ctx = viewer.drawer.canvas.getContext('2d');
imgData = ctx.getImageData(x=rect.x,y=rect.y,rect.width,rect.height);
loadImageToCanvas(imgData);
}
function loadImageToCanvas(imgData, canvasId=22, hidden=false) {
let canvas = document.createElement('canvas');
canvas.id = canvasId;
canvas.width = imgData.width;
canvas.height = imgData.height;
div = $('#canvas');
let context = canvas.getContext("2d");
context.putImageData(imgData, 0, 0);
div.append(canvas);
if (hidden) {
canvas.style.display = 'none';
}
}
我经过openseadragonselection,一切似乎都很好。我在这里想念什么?