Pictures using CSS3 filter cannot be saved

topic description

has anyone encountered such a problem
canvas.toDataURL failed, tainted canvases may not be exported.
1, the picture has been set crossorigin= "anonymous"
2, as long as the picture does not use the svg filter of the CSS3 filter (such as filter:url (filter.svg-sharpwarm)), there are no errors

related codes

    let canvas:HTMLCanvasElement = document.createElement("canvas");
    canvas.width = this.img.width;
    canvas.height = this.img.height;
    // let dpr = this.getDPR();
    let context = canvas.getContext("2d");
    (context as any).filter = window.getComputedStyle(this.imgDom).filter;
    console.log(window.getComputedStyle(this.imgDom).filter);
    
    context.drawImage(this.img, 0, 0, canvas.width, canvas.height);

    let aryURL = canvas.toDataURL("image/jpeg").split(",");
    let mine = aryURL[0].match(/:(.*?);/)[1];
    let  dataUrl = new Blob([toByteArray(aryURL[1])], {type: mine});
Oct.04,2021
Menu