We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very nice tool!!! Is there some useful API in wasm module for converting blp files? I tried some module, but allways loss quality.
The text was updated successfully, but these errors were encountered:
You mean converting blp to png? I'm using libjpeg for conversion, the code is here: https://github.com/d07RiV/wc3data/blob/master/DataGen/image/imageblp.cpp
Sorry, something went wrong.
Yes, thank you! I'll try it. And it can be compiled to wasm module? I build them with emscripten like blew but it seems not working.
EM_JS(void, write_output, (void const* ptr, int size), { window.postResult(HEAPU8.slice(ptr, ptr + size)); }); extern "C"{ EMSCRIPTEN_KEEPALIVE int convertImage(void const* data_ptr, uint32 data_size,ImageFormat::Type format) { File f; f = MemoryFile((uint8*)data_ptr, (size_t)data_size); Image image; image = ImagePrivate::imRead(f,format); if (image) { MemoryFile file; image.write(file); write_output(file.data(), file.size()); return 1; } return 0; } }
The html code
window.postResult = function(msg) { if (msg) { const blob = new Blob([msg], { type: 'image/png' }); document.querySelector('#image').setAttribute('src', URL.createObjectURL(blob)); } else { console.error(msg); } }; setTimeout(() => { fetch('./aaa.blp').then(res => res.arrayBuffer().then(data => { ImgParser().then(wasm => { const array = new Uint8Array(data); const addr = wasm._malloc(array.length); wasm.HEAPU8.set(array, addr); wasm._convertImage(addr, array.length, 3); wasm._free(addr); }); }) ); }, 1000);
No branches or pull requests
Very nice tool!!!
Is there some useful API in wasm module for converting blp files?
I tried some module, but allways loss quality.
wc3data
other
The text was updated successfully, but these errors were encountered: