Vectorize (image to vector) - fotojockovic.com/vectorize ======================================================== Turns raster images (PNG, JPG, WebP, GIF, BMP) into vector graphics (SVG, PDF, EPS, DXF) and sharp PNGs. Everything runs in the browser; no image leaves the device. Our own work, written for this tool (source: src-rs/, MIT licence): the whole tracing engine, compiled from Rust to WebAssembly (vz.wasm) and run in worker.js, with no third-party code or crates in it: - perceptual colour clustering (OKLab) with automatic palette size and removal of anti-aliasing mixtures - anti-alias-aware pixel labelling, thin-feature (hairline) rescue, 2x upsampled tracing of small graphics - region building with resolved diagonal connections, speckle merging, JPEG artefact handling - shared-boundary topology on the pixel-crack lattice (no gaps or overlaps between shapes), stacked or cut-out output with sub-pixel underlaps - sub-pixel edge positions from pixel coverage, corner detection and refinement, straight-line, fillet, arc and circle recognition, least-squares cubic Bezier fitting, axis snapping - pixel-art mode (exact or smoothed), single-line (centerline) mode, photo mode with optional gradients - JPEG artefact removal with the file's own quantisation tables (projection onto the quantisation constraint set with an edge-preserving prior; chroma restored on its subsampled grid and upsampled guided by luma) - repeated-shape consensus (letters, icons): sub-pixel alignment, median coverage, traced once, SVG - mirror-axis and per-shape rotational/mirror symmetry (fit one half, mirror it), geometric regularisation - render-and-compare refinement of all control points (exact-area anti-aliased rasteriser, edge-sampled gradients, damped Gauss-Newton steps), blur-aware for out-of-focus sources - lighting correction for photographed prints, perspective straightening (in app.js) - designer-style fills in every mode: exact colours as robust medians of each shape's interior, sharp-peak detection that keeps near-identical brand colours apart, quantisation bands of one ramp merged back into a single shape, gradient fitting (linear, radial, elliptical, focal radial; multi-stop profiles) chosen by fit error, region growing for gradient shapes; photo mode keeps its own linear/radial fills - transparency: see-through areas found from the alpha channel and written with fill-opacity (PDF: ExtGState) - strokes as strokes: constant-width bands (lines, rings, swooshes) become one stroked centre path with the measured width and butt or round caps - embedded ICC profiles (matrix/TRC: Display P3, Adobe RGB, ...) read from JPEG files, so JPEG restoration runs in the file's own colour space - SVG, EPS (Level 3 shfill), DXF (R12) and PDF writers; gradients become PDF shading types 2/3 with stitching functions - multi-threading (vz-mt.wasm): our own fork-join job pool on shared WebAssembly memory with helper Web Workers, per-thread small-block allocator; every job writes only its own output and results are combined in a fixed order, so the threaded and single-thread builds give byte-identical results The page, its UI and texts are our own as well. Optional "Sharpen text (AI)" step (downloaded only when switched on; files in ai/, see ai/LICENSES.txt): - waifu2x model swin_unet/art/noise3_scale2x from nunif by nagadomi, https://github.com/nagadomi/nunif (ONNX export waifu2x_onnx_models_20250502), MIT License. Stored here with 16-bit weights (same network). - waifu2x models swin_unet/art/noise0_scale4x and swin_unet/art/noise3_scale4x from the same nunif ONNX export, MIT License, 16-bit weights: the 4x path for very small inputs (noise0 for clean PNGs, noise3 for JPEGs). - ONNX Runtime Web 1.23.0 by Microsoft, https://github.com/microsoft/onnxruntime, MIT License: runs the model with WebGPU or WebAssembly (threads when the page is cross-origin isolated). - Our own: tiling with cross-faded overlaps (sr.js), detection of already-enlarged images (shrink to the native size first), the worker, and tracing the 2x result with the vectors scaled back to the original size. Published methods the engine builds on (ideas only; no code was copied): - B. Ottosson, "A perceptual color space for image processing" (OKLab), 2020 - public domain formulas. - P. J. Schneider, "An Algorithm for Automatically Fitting Digitized Curves", Graphics Gems, 1990. - T. Y. Zhang, C. Y. Suen, "A fast parallel algorithm for thinning digital patterns", CACM, 1984. - J. Kopf, D. Lischinski, "Depixelizing Pixel Art", SIGGRAPH 2011 (heuristics for diagonal connections). - G. Taubin, "A signal processing approach to fair surface design", SIGGRAPH 1995 (shrink-free smoothing). - Kasa / Gauss-Newton circle fitting, Otsu thresholding, bilateral filtering (textbook methods). - ICC.1 specification (International Color Consortium) for profile parsing; PDF 1.4 and PostScript Level 3 reference manuals (Adobe) for shadings and transparency. - A. Zakhor, "Iterative procedures for reduction of blocking effects in transform image coding", 1992, and later POCS deblocking work (projection onto quantisation constraint sets). - T.-M. Li et al., "Differentiable Vector Graphics Rasterization for Editing and Learning" (DiffVG), 2020 (the idea of edge-sampled gradients for vector shapes). - The signed-area accumulation rasteriser follows the approach of font-rs by Raph Levien (Apache-2.0); our implementation is written from the algorithm's description. - P. Heckbert, "Fundamentals of Texture Mapping and Image Warping", 1989 (square-to-quad homography). Sample images (samples/): - logo.jpg, logo.svg, logo_t.jpg: a fictional cafe logo drawn for this tool (our own work); the logo text is set in DejaVu Sans (Bitstream Vera licence / public domain changes; free to use) and rasterised. - pixel.png, pixel_t.jpg: pixel-art mushroom drawn for this tool (our own work). - sketch.jpg, sketch_t.jpg: line drawing made for this tool, with a simulated pencil-on-paper scan (our own work). - painting.jpg, painting_t.jpg: Vincent van Gogh, Wheat Field with Cypresses, 1889. The Metropolitan Museum of Art, Open Access, CC0 1.0, object 436535 (resized). Fonts from Google Fonts (self-hosted), SIL Open Font License 1.1: Inter Tight (Rasmus Andersson et al.), Instrument Serif (Instrument). Shared helpers /static/tools/common/i18n.js, rail.js and sheets.js: our own. Language flags in the language picker: simplified flag drawings made for these tools, our own work; the national flags themselves are public-domain symbols. Translations of the interface are our own. Used only to build and test, never shipped to the browser: Rust and cargo (MIT/Apache-2.0; the threaded build recompiles the Rust standard library, MIT/Apache-2.0, which is part of vz-mt.wasm like it is of vz.wasm); binaryen (Apache-2.0) for wasm-opt; for the quality benchmark: resvg (MPL-2.0), VTracer (MIT) and potrace (GPL, run locally as a comparison reference only). No GPL code is shipped. No machine-learning model is used. Self-hosted web fonts (2026-10-19): Inter Tight, Instrument Serif. SIL Open Font License 1.1. The woff2 files are the ones Google Fonts serves (latin, latin-ext, cyrillic, greek subsets where the family has them), stored on our own server under /static/tools/common/fonts// with each family's licence text (OFL.txt) next to them; stylesheet /static/tools/common/fonts/ui.css. No font request goes to Google.