JS (Emscripten) version of imageresampler