Summary
Hello Krita devs and community,
I’m the maintainer of Img2Num, an open-source project that started as a browser web app for converting raster images into color-by-number SVG templates. I’m refactoring the project to be library-first (C++ core with a clear API) so it can be embedded into other applications. I’d like to propose that Krita consider integrating Img2Num (or parts of it) as an optional library or plugin to add raster → SVG / vectorization features.
Why this could help Krita
-
Convert raster artwork into editable vector paths: Img2Num isolates flat regions and converts them into SVG path elements. Those paths can be converted into Krita vector layers or editable shapes, enabling fine-grained vector editing of raster artwork.
-
Layer isolation & selective editing: Each detected region becomes an independent path, which is easy to map to separate layers, masks, or groups in Krita for non-destructive editing.
-
Fast C++ core: The library is implemented in C++, which was designed to be fast and portable. It already compiles to WebAssembly for the demo; a native C++ library would be straightforward to integrate into Krita’s plugin or core codebase.
-
Useful for designers and illustrators: Vectorizing flattened scans, posterizing artwork, creating coloring templates, or producing clean assets that are easier to scale and export.
Technical overview
-
Language / build: Core vectorization module is in C++, currently built for the web via Emscripten in the demo, but structured to be library-first so native builds are supported. It won’t be long before the project is converted to a library.
-
Input / Output: Accepts raster images (PNG / JPG / etc.) → outputs SVG (paths, fills). The library can also return an intermediate path list or per-region masks if Krita prefers direct layer/mask creation instead of SVG import.
-
API ideas:
-
vectorize(image, settings) -> SVG— simple one-call API. -
vectorize_to_regions(image, settings) -> vector<Region>— returns per-region geometry + color, useful to create Krita vector layers directly. -
Configurable parameters: color quantization levels, smoothing, minimum area threshold, merge/split heuristics.
-
-
Performance: Written with performance in mind; runs in native C++ quickly. A WASM build exists for browser demos which shows the algorithm is portable - it runs well on mobile device CPUs via a browser.
Possible integration approaches for Krita
-
Standalone plugin (recommended first step)
-
Provide a Krita plugin that calls the Img2Num native library to produce either an imported SVG or a set of Krita vector layers and masks.
-
Pros: Minimal impact to Krita core, quick to iterate.
-
-
Core/shared library
-
Add Img2Num as an optional dependency in Krita’s build system and expose vectorization in the UI as
Filter → Vectorize (Img2Num)or similar. -
Pros: Tighter UX integration, more control over memory and threading.
-
-
Scripted wrapper
-
Supply a Python wrapper around the native library so plugin authors can easily call it from Krita’s Python plugin system. Python support is already planned, so this is not a stretch.
-
Pros: Low friction for community-driven experimentation.
-
UX suggestions
-
A small dialog with sliders for: color count / quantization, smoothing radius, minimum area size, and an
Advancedtab for merging heuristics. -
A preview pane (low-res) to show the detected regions, with toggles to export as SVG vs. Krita vector layers vs. Krita vector + mask pairs.
How you can test/demo
- The GitHub repository contains the source and build instructions. The project currently has a browser demo (WASM) for quick experimentation; I can provide native build instructions or a prebuilt binary if maintainers want to try it locally.
License & contribution
-
Img2Num is open source. I am open to aligning licensing or making adjustments needed for compatibility with Krita’s ecosystem, but I don’t think that will even be necessary.
-
I’m eager to submit a proof-of-concept plugin / PR or pair-program with someone from the Krita team to get an initial integration working.
Next steps / Call to action
If this sounds useful, I’d love to:
-
Hear feedback from Krita devs about preferred integration approach (plugin vs. core vs. Python wrapper).
-
Provide a small demo PR or a plugin skeleton that shows importing vectorized output directly into Krita as vector layers.
-
Work with interested contributors on UX and edge cases (antialiasing, complex gradients, textured fills).
Thank you for reading — I’d be excited to help bring raster → SVG vectorization into Krita. If anyone on the team wants to chat or test, please reply here or reach me via the repository discussions / issues tab.
Useful links
-
Img2Num GitHub: https://github.com/Ryan-Millard/Img2Num