This repo contains a simple image converter (PNG ↔ JPG) using WASM technology and C++ code.
Features:
- client-side multiplattfom C++ logic execution in browser (x86/ARM, Windows/MacOS/Linux)
- extensible to other (exotic) formats like
PNM
orTIFF
, see here (section "Supported Image Formats)
- Web assembly
- Bootstrap
- Emscripten compiler (em++/emcc)
- VS Code
There are various image converters on the net which can be implemented one of the following way:
- send the files to the server, where the conversion logic is implemented
- JS client-side conversion via
canvas
drawing and export functionality, see Centipede5/imageconverter.
However this implementation serves as a technology test for a particular task.
- Install boost library
- Build shared libraries for
boost::filesystem
andboost::gil
- Run
make build
in the root directory. The executable is inbuild
directory.
- Install Emscripten SDK
- Activate emscripten for current terminal session (e.g.
source ~/emsdk/emsdk_env.sh
) - In order to build
libjpeg
static library go tobuild/include
and runemconfigure ./configure
andemmake make
. - In the root folder:
make wasm_page
to buildwasm
artifact and corresponding.js
code. - Run an HTTP server in website/
- Enjoy!
MIT