+ [task127424] add image onload of think3c widget.

This commit is contained in:
wangzemei
2024-09-04 03:27:22 +00:00
committed by qixinzhi
parent 8b44ea3113
commit bf964f9e1e
+13
View File
@@ -6,6 +6,19 @@ $(document).ready(function()
const maxWidth = $('.think-model-content').width() || 500;
const maxHeight = maxWidth;
image.onload = function()
{
let width = image.width;
let height = image.height;
canvas.width = width;
canvas.height = height;
ctx.drawImage(image, 0, 0, width, height);
const imageData = ctx.getImageData(0, 0, width, height);
const pixels = binarizeImage(imageData);
ctx.putImageData(pixels, 0, 0);
};
image.src = modelImg;
/* 检查图片是否已加载完成,如未完成,手动触发处理逻辑。*/