我正在尝试将dicom图像复制到剪贴板,并且我将其用于宽度/高度较小的图像。如果宽度/高度中的任何一个较大,则将复制的图像粘贴到编写者文档时,图像的一小部分将变灰。
var d = document.createElement('div');
d.contentEditable = true;
var img1 = document.createElement('img');
html2canvas($(".image"), {
width : 2000,
height : 500,
logging: true,
letterRendering: 1, allowTaint : false,
useCORS: true ,
onrendered: function(canvas) {
var myImage = canvas.toDataURL("image/jpeg");
clipboard(canvas.toDataUrl("image/jpeg"));
}
});
function clipboard(uri){
img1.src = uri;
d.appendChild(img1);
document.body.appendChild(d);
enter image description hereSelectText(d);
return;
}
function SelectText(element) {
var doc = document;
if (doc.body.createTextRange) {
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();console.log(range);
} else if (window.getSelection) {
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);console.log(range);
}
}
在下面提供显示问题的链接。底角显示为灰色,而显示为base64
https://imggmi.com/full/2019/5/15/083abcce2a4c72c3f2acb667ec74c9cd-full.png.html