我正在编写一些Javascript代码,它使用Photoshop嵌入的路径创建图像的alpha蒙版。IMG标记的onload处理程序将调用一个剪辑(This)。该函数加载图像的源文件并扫描它。下面是设置:
function clip(img) {
var xhr = new XMLHttpRequest();
xhr.open('GET', img.src, true);
xhr.responseType = 'arraybuffer';
xhr.target = img;
xhr.onload = function(e) {
var bytes = new Uint8Array(this.response);
var p = findPhotoshopSegment(bytes);
if(p) {
var paths = parse8BIMData(bytes, p);
/* ... replaces IMG with SVG tag ... */
}
};
xhr.send();
}
您可以在http://flaczki.net46.net/JPEG/SVG.html上查看实际运行的代码
目前,它只适用于Firefox、Chrome和Safari。它在IE9中不起作用。浏览器支持SVG,但不支持Uint8Array。有什么变通方法吗?
https://stackoverflow.com/questions/11881472
复制相似问题