tiff2bmpsw using libtiff wasm

git source: https://github.com/horo-t/tiff2bmpsw.git

WebAssembly实现tiff转bmp(使用libtiff库)
1) download source:
http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz
2) 解压、patch
tar xvfz tiff-4.0.9.tar.gz
cd tiff-4.0.9
patch -u libtiff/tiff.h < ../tiff_h_int_size.patch
3)编译libtiff
emconfigure
emmake make
4)编译tiff2bmp
cd..
emcc tiff2bmpsw.c \
./tiff-4.0.9/libtiff/.libs/libtiff.a \
-I./tiff-4.0.9/libtiff \
-s EXPORTED_FUNCTIONS=”[‘_tiff_to_bmp’]” \
-s EXTRA_EXPORTED_RUNTIME_METHODS=”[‘ccall’, ‘cwrap’]” \
–pre-js LICENSE \
–pre-js tiff2bmpsw_pre.js \
–js-library tiff2bmpsw_jslib.js \
–post-js tiff2bmpsw_post.js \
-o tiff2bmpsw.js

注意加粗部分为改过的,红色部分为新加上去的不然运行报ccall没导出的错误

编完后把tiff2bmpsw.html、tiff2bmpsw.js、tiff2bmpsw.wasm放在web服务器上,就可以玩了

发表评论