Img2Num C++
Features
- Fast raster vectorization with WASM backend.
- Typed array support: Works with
Uint8Array,Uint8ClampedArray, andInt32Array. - String outputs: Converts results directly into SVG strings.
- Worker-friendly: Supports offloading heavy computations to Web Workers.
- Zero dependencies: Pure WASM + JS with no external libraries required.
Installing from Source Code
Using a Git Submodule (recommended for most projects)
Add Img2Num as a submodule
Add the submodule in a folder named Img2Num
git submodule add https://github.com/Ryan-Millard/Img2Num.git Img2Num
git submodule update --init --recursive
Update your CMakeLists.txt
Add Img2Num as a subdirectory and link the library
add_subdirectory(Img2Num)
target_link_libraries(<your-project-name> PRIVATE Img2Num)
Include an Img2Num Header
Include any public header
#include "img2num"
Build your project
Initialise CMake and build the project
cmake -B build .
cmake -S . --build build
You should be good to go now!
Using find_package
Clone Img2Num
git clone --recursive https://github.com/Ryan-Millard/Img2Num.git
cd Img2Num
Build Img2Num
cmake -S . -B build
cmake --build build
Failed to build?
Try running this to refresh the submodules
git submodule update --init --recursive
If that doesn't work, please open an issue or a discussion on our GitHub repository.
Install the library
cmake --install build
Optional: Go back to original directory
cd ..
Update your CMakeLists.txt
Add Img2Num as a subdirectory and link the library
find_package(Img2Num REQUIRED)
target_link_libraries(my_app PRIVATE Img2Num::Img2Num)
Include an Img2Num Header
- Namespaced
- Normal
Include any public header
#include <img2num/img2num.h>
Include any public header
#include <img2num.h>
You should be good to go now!