Javascript 为什么可以';我不能在浏览器中解码太重的bpg图像吗?
使用Fabrice Bellard提供的bpg编码器,按照我的Debian 8上的以下说明,我已经完成了一些压缩测试,并在我的浏览器(firefox chrome)上用提供的.js显示结果(或者您可以使用) 当我想显示重量大于(约)800 KB(原始重量:2.6 MB,大小3600x2700)的bpg图像时,控制台中会显示以下错误消息:Javascript 为什么可以';我不能在浏览器中解码太重的bpg图像吗?,javascript,image-processing,bpg,Javascript,Image Processing,Bpg,使用Fabrice Bellard提供的bpg编码器,按照我的Debian 8上的以下说明,我已经完成了一些压缩测试,并在我的浏览器(firefox chrome)上用提供的.js显示结果(或者您可以使用) 当我想显示重量大于(约)800 KB(原始重量:2.6 MB,大小3600x2700)的bpg图像时,控制台中会显示以下错误消息: > Successfully compiled asm.js code (loaded from cache in 21ms) > pre-ma
> Successfully compiled asm.js code (loaded from cache in 21ms)
> pre-main prep time: 0 ms
> Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 33554432, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.
> uncaught exception: abort() at wa@https://webencoder.libbpg.org/js/bpgdec8.js:19:34
> B@https://webencoder.libbpg.org/js/bpgdec8.js:85:320
> z.b@https://webencoder.libbpg.org/js/bpgdec8.js:11:48
> Z@https://webencoder.libbpg.org/js/bpgdec8.js:53:333
> Vd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> fd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> sd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Mc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Sc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Tc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> _b@https://webencoder.libbpg.org/js/bpgdec8.js:66:1 Kb@https://webencoder.libbpg.org/js/bpgdec8.js:66:1
> Pc@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Pd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> Kd@https://webencoder.libbpg.org/js/bpgdec8.js:70:1
> @https://webencoder.libbpg.org/js/bpgdec8.js line 15 > eval:1:84
> window.BPGDecoder.prototype.load/d.onload@https://webencoder.libbpg.org/js/bpgdec8.js:88:216 If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
> Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 33554432, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.
有人知道这个错误是从哪里来的吗?自述文件中的第7节给出了问题的根源: 仅8位的解码器速度稍快,占用内存较少 (默认情况下,您可以更改内存,而不是32 MB 如果要处理较大的图像,请在Makefile中进行配置) =>默认情况下,过大的图像以JavaScript文件无法显示的方式编码
错误代码(见上文)解释了如何修复该问题:您必须编辑Makefile中的相应行,然后重新编译项目。错误消息告诉您错误所在以及可以采取的措施:“无法扩大内存数组。或者(1)使用-s TOTAL_memory=X编译,X高于当前值33554432,(2) 使用ALLOW_MEMORY_GROWTH进行编译,它可以在运行时调整大小,但会阻止一些优化,或者(3)在程序运行之前设置Module.TOTAL_内存。“嗯……我觉得奇怪的是,只有图像的重量才是这个错误的原因