Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c4b3ea8
refactor(fs): initial monorepo layout
Ryan-Millard Jan 29, 2026
b88514f
chore(legal): update licenses - see conversation in #230
Ryan-Millard Jan 29, 2026
baa321f
chore(core-lib): cleanup fs
Ryan-Millard Jan 29, 2026
d84a37d
refactor(builds): core as shared lib other link to it
Ryan-Millard Jan 29, 2026
0589276
feat(js-package): create basic start of JS-wasm package
Ryan-Millard Jan 29, 2026
be5854f
broken
Ryan-Millard Feb 2, 2026
e7e38ed
finally a working project!!
Ryan-Millard Feb 3, 2026
cd222d4
fix(js-package): use correct package type - module
Ryan-Millard Feb 4, 2026
2079dc1
feat(react-example): add /about to sitemap
Ryan-Millard Feb 4, 2026
43e47b4
Merge branch 'main' of https://github.com/Ryan-Millard/Img2Num into r…
Ryan-Millard Feb 8, 2026
867b982
refactor(CMake): make internal headers private & separate builds prop…
Ryan-Millard Feb 8, 2026
0bd766a
chore(monorepo): migrate to pnpm workspace
Ryan-Millard Feb 8, 2026
51561c5
chore(js-scripts): reconfig legacy CLI scripts
Ryan-Millard Feb 9, 2026
7039641
feat(.npmrc): add initial .npmrc file
Ryan-Millard Feb 10, 2026
7b781dc
refactor(docker): update to use pnpm & new dev env
Ryan-Millard Feb 10, 2026
0f1cf4b
ci(ci and deploy): update to reflect new repo structure
Ryan-Millard Feb 10, 2026
6c88166
fix(root-package.json): add format scripts and update validate-scripts
Ryan-Millard Feb 10, 2026
68fa94f
style(format): format all files
Ryan-Millard Feb 10, 2026
2435c67
ci(build-docs, build-react-app): fix: add pnpm install before build
Ryan-Millard Feb 10, 2026
d1bd5c5
ci(ci.yml): fix typo - lint -> eslint
Ryan-Millard Feb 10, 2026
b1723fa
style(eslint): remove unused var in format-cpp.js
Ryan-Millard Feb 10, 2026
b07bf4f
fix(deps): add uninstalled peer deps
Ryan-Millard Feb 11, 2026
1b9dd65
fix(docs-build): pnpm + webpack in docusaurus error
Ryan-Millard Feb 13, 2026
cde7327
ci(format-check): fix prettier formatting error
Ryan-Millard Feb 13, 2026
95ea01f
chore(dev-scripts): fix script validation
Ryan-Millard Feb 13, 2026
629a080
ci(ci.yml permissions): restrict to read permissions
Ryan-Millard Feb 13, 2026
0c8c700
chore(license): update entire repo licensing - see #230
Ryan-Millard Feb 13, 2026
3eb0296
chore(cpp-console): remove debug printing
Ryan-Millard Feb 13, 2026
464a597
fix(wasmClient): reject pending callbacks on termination
Ryan-Millard Feb 13, 2026
9099d04
feat(wasmClient): worker load/init failures no longer silently lost
Ryan-Millard Feb 13, 2026
cdb6727
refactor(js-binding): cmake exit runtime and initial memory
Ryan-Millard Feb 13, 2026
17e181e
chore(image_utils): move includes to cpp & add guard
Ryan-Millard Feb 13, 2026
05d7036
fix(kmeans): prevent float-to-uint8_t overflow in RGB centroid
Ryan-Millard Feb 13, 2026
3108def
fix(wasmWorker): move validation inside try block and post errors to …
Ryan-Millard Feb 13, 2026
2c31622
fix(wasmWorker): wrap string errors in Error objects before rejecting
Ryan-Millard Feb 13, 2026
c09dc12
chore(deps-react): move tanstack/react-query from dev deps to deps
Ryan-Millard Feb 13, 2026
a4229a1
ci(permissions): update build & deploy permissions
Ryan-Millard Feb 13, 2026
08f9662
style(eslint): mark unused vars with `_` prefix
Ryan-Millard Feb 13, 2026
e8270e8
style(format): fix code styles & update .prettierignore
Ryan-Millard Feb 13, 2026
f153e01
Merge branch 'main' into refactor/monorepo
Ryan-Millard Feb 14, 2026
136ce2a
chore(approve-builds): approve pnpm builds for some packages
Ryan-Millard Feb 14, 2026
5244d6a
chore(js-pkg): move imageToUint8ClampedArray into JS package
Ryan-Millard Feb 14, 2026
a27d27e
docs(js): add jsdocs & typedoc docusaurus plugin
Ryan-Millard Feb 14, 2026
5366325
docs(cleanup): remove old resources
Ryan-Millard Feb 14, 2026
62950de
style(format): format all files
Ryan-Millard Feb 14, 2026
135917e
docs(restructure): change to match monorepo & be kind to newcomers
Ryan-Millard Feb 14, 2026
8699330
docs(README.md, CONTRIBUTING.md): update links & simplify content
Ryan-Millard Feb 14, 2026
d5dddea
docs(cleanup & guide): clean up docs structure & add internal install…
Ryan-Millard Feb 14, 2026
a6e1ce2
style(format): format docs files
Ryan-Millard Feb 14, 2026
8d795fc
docs(structure): improve structure & update some content
Ryan-Millard Feb 15, 2026
e85d8d4
style(format-script): add distinct colors & success message, also for…
Ryan-Millard Feb 15, 2026
dda3045
fix(format-check): fix bad path for check arg in format:check script
Ryan-Millard Feb 15, 2026
6ab4c59
ci(deploy.yml): fix: Unpinned tag for a non-immutable Action in workflow
Ryan-Millard Feb 15, 2026
2278913
fix(format-script): Uncontrolled command line
Ryan-Millard Feb 15, 2026
8d46169
docs(wasmWorker): false positive: Missing origin verification in han…
Ryan-Millard Feb 15, 2026
9b6da8c
refactor(format-script): remove argument forwarding entirely
Ryan-Millard Feb 15, 2026
3e979f8
docs(img2num.h): add Doxygen comments
Ryan-Millard Feb 16, 2026
9e61615
docs(doxygen): introduce shared Doxygen config and generation script …
Ryan-Millard Feb 17, 2026
5fd4640
docs(doxygen-docusaurus): embed Doxygen C++ API reference with fullsc…
Ryan-Millard Feb 17, 2026
b3c0377
refactor(validate-scripts): make it reusable, add ignore list _meta o…
Ryan-Millard Feb 18, 2026
49d5bc8
style(format): format all files
Ryan-Millard Feb 18, 2026
c4a9676
docs(refactor-notice): add simple announcement about incomplete docs
Ryan-Millard Feb 18, 2026
6696370
docs(js-disclaimer): package not on NPM - docs are placeholder
Ryan-Millard Feb 18, 2026
7f3e78e
Merge branch 'main' into refactor/monorepo
Ryan-Millard Feb 18, 2026
3b2ce58
docs(version): update to have old and next
Ryan-Millard Feb 18, 2026
3e63cbd
chore(licenses): add/update LICENSE files
Ryan-Millard Feb 18, 2026
42e6fac
chore(README): update links
Ryan-Millard Feb 18, 2026
b33c312
docs(docs-sidebar): fix order
Ryan-Millard Feb 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
Expand All @@ -26,10 +17,6 @@ dist-ssr
# OS Files
*:Zone.Identifier

src/data/contributor-credits.json

.env
# CMake build artifacts
src/wasm/cmake-build/
src/wasm/**/CMakeCache.txt
src/wasm/**/CMakeFiles/

build*
Comment thread
Ryan-Millard marked this conversation as resolved.
Resolved
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# =================================================================
# Img2Num Top-Level
# =================================================================
cmake_minimum_required(VERSION 3.16)
project(Img2Num LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()

# Core library
add_subdirectory(core)

# JS bindings
add_subdirectory(bindings/js)
65 changes: 65 additions & 0 deletions bindings/js/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# =================================================================
# JS/WASM binding using core object library
# =================================================================
cmake_minimum_required(VERSION 3.16)
project(JSBindings LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Must be built with Emscripten
if(NOT EMSCRIPTEN)
message(FATAL_ERROR "Emscripten is required to build JS bindings.")
endif()

# Collect binding sources
file(GLOB_RECURSE BINDING_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
file(GLOB_RECURSE BINDING_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")

# Build WASM module
add_executable(img2num_wasm ${BINDING_SRC})

# Link core library object files
target_link_libraries(img2num_wasm PRIVATE core)

# Include directories
target_include_directories(img2num_wasm PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)

# Emscripten options
set(COMMON_FLAGS
"SHELL:-s MODULARIZE=1"
"SHELL:-s EXPORT_ES6=1"
"SHELL:-s EXIT_RUNTIME=1"
"SHELL:-s ENVIRONMENT=web,worker"
"SHELL:-s EXPORTED_FUNCTIONS=['_malloc','_free']"
"SHELL:-s EXPORTED_RUNTIME_METHODS=['ccall','cwrap','getValue','setValue','HEAPU8','HEAP32']"
"SHELL:-s INITIAL_MEMORY=1024MB"
"SHELL:-s MAXIMUM_MEMORY=2048MB"
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
"SHELL:-s EXPORT_NAME=createImg2NumModule"
"SHELL:-s USE_PTHREADS=1"
"SHELL:-s PTHREAD_POOL_SIZE=8"
)

target_compile_options(img2num_wasm PRIVATE -pthread -msimd128)
target_link_options(img2num_wasm PRIVATE ${COMMON_FLAGS} -pthread -msimd128)

# Build type flags
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(img2num_wasm PRIVATE -O2 -g4)
target_link_options(img2num_wasm PRIVATE "SHELL:-s ASSERTIONS=2" -g4)
else()
target_compile_options(img2num_wasm PRIVATE -O3)
target_link_options(img2num_wasm PRIVATE "SHELL:-s SINGLE_FILE=0")
endif()

# Output location
set_target_properties(img2num_wasm PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/packages/js/build-wasm"
OUTPUT_NAME "index"
SUFFIX ".js"
)

message(STATUS "WASM module configured: img2num_wasm")
7 changes: 7 additions & 0 deletions bindings/js/src/wasm_wrapper.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <emscripten/bind.h>
#include "image_utils.h"
#include "exported.h"

EXPORTED void gaussianBlurFft(uint8_t *image, size_t width, size_t height, double sigma) {
gaussian_blur_fft(image, width, height, sigma);
}
13 changes: 13 additions & 0 deletions bindings/py/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# =================================================================
# Python bindings via pybind11
# =================================================================
find_package(Python COMPONENTS Interpreter Development REQUIRED)
find_package(pybind11 REQUIRED)

pybind11_add_module(img2num_python
src/python_wrapper.cpp
)

# Link Python module to shared core library
target_link_libraries(img2num_python PRIVATE img2num_core)
target_include_directories(img2num_python PRIVATE ${CMAKE_SOURCE_DIR}/core/include)
10 changes: 10 additions & 0 deletions bindings/py/src/python_wrapper.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <pybind11/pybind11.h>
#include "img2num.h"

namespace py = pybind11;

PYBIND11_MODULE(img2num, m) {
m.doc() = "Img2Num library";

//m.def("some_function", &some_function, "A function from Img2Num");
}
2 changes: 1 addition & 1 deletion src/wasm/.gitignore → core/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# WASM build directory
build/
cmake-build/

# C++ object and binary files
*.o
Expand Down
27 changes: 27 additions & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# =================================================================
# Img2Num Core (Object Library)
# =================================================================
cmake_minimum_required(VERSION 3.16)
project(CoreLibrary LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Collect sources
file(GLOB_RECURSE CORE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
file(GLOB_RECURSE CORE_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")

# Build as object library
add_library(core OBJECT ${CORE_SRC} ${CORE_HEADERS})

target_include_directories(core PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)

# If building with Emscripten and pthreads
if(EMSCRIPTEN)
target_compile_options(core PRIVATE -pthread -msimd128)
target_link_options(core PRIVATE -pthread -msimd128)
endif()

message(STATUS "Core library configured with ${CORE_SRC}")
21 changes: 21 additions & 0 deletions core/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ryan Millard

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,16 @@ template <typename Tin, typename Tout>
void rgb_to_lab(const ImageLib::RGBAPixel<Tin> &rgba,
ImageLib::LABAPixel<Tout> &laba) {

rgb_to_lab<Tin, Tout>(rgba.red, rgba.green, rgba.blue, laba.l, laba.a,
laba.b);
Tout l{laba.l};
Tout a{laba.a};
Tout b{laba.b};

rgb_to_lab(rgba.red, rgba.green, rgba.blue, l, a, b);

laba.l = l;
laba.a = a;
laba.b = b;

laba.alpha = static_cast<Tout>(rgba.alpha);
}

Expand All @@ -203,9 +211,11 @@ void rgb_to_lab(const ImageLib::RGBPixel<Tin> &rgb,
template <typename Tin, typename Tout>
void lab_to_rgb(const ImageLib::LABAPixel<Tin> &laba,
ImageLib::RGBAPixel<Tout> &rgba) {
Tout r{rgba.red};
Tout g{rgba.green};
Tout b{rgba.blue};

lab_to_rgb<Tin, Tout>(laba.l, laba.a, laba.b, rgba.red, rgba.green,
rgba.blue);
lab_to_rgb<Tin, Tout>(laba.l, laba.a, laba.b, r, g, b);
rgba.alpha = static_cast<Tout>(laba.alpha);
Comment thread
Ryan-Millard marked this conversation as resolved.
Resolved
}

Expand All @@ -216,4 +226,4 @@ void lab_to_rgb(const ImageLib::LABPixel<Tin> &lab,
lab_to_rgb<Tin, Tout>(lab.l, lab.a, lab.b, rgb.red, rgb.green, rgb.blue);
}

#endif
#endif
File renamed without changes.
24 changes: 24 additions & 0 deletions core/include/exported.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef EXPORTED_H
#define EXPORTED_H

// Macro to export functions for WASM or other C compilers

#ifdef __EMSCRIPTEN__
// Emscripten (Web Assembly) compilation (avoid name
// mangling & instruct emscripten to keep it)
#include <emscripten/emscripten.h>
#define EXPORTED extern "C" EMSCRIPTEN_KEEPALIVE

#else

#ifdef __cplusplus
// Standard C++ compilation (avoid name mangling)
#define EXPORTED extern "C"
#else
// Standard C compilation (nothing)
#define EXPORTED
#endif

#endif

#endif // EXPORTED_H
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <cstdint>
#include <limits>
#include <vector>
#include <cstring>
#include <iostream>
Comment thread
Ryan-Millard marked this conversation as resolved.
Resolved

// image: pointer to RGBA data
// width, height: dimensions
Expand All @@ -15,6 +17,8 @@ void gaussian_blur_fft(uint8_t *image, size_t width, size_t height,
if (!image || width == 0 || height == 0 || sigma_pixels <= 0)
return;

std::cout << "Here I am!!!" << std::flush;

const size_t Npix = width * height;

// Compute padded dimensions (next power of two)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <numeric>
#include <random>
#include <vector>
#include <cstring>

static constexpr uint8_t COLOR_SPACE_OPTION_CIELAB{0};
static constexpr uint8_t COLOR_SPACE_OPTION_RGB{1};
Expand Down
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions example-apps/react-js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# OS Files
*:Zone.Identifier

src/data/contributor-credits.json

.env
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading