惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
IT之家
IT之家
T
The Blog of Author Tim Ferriss
V
V2EX
博客园 - 聂微东
The Cloudflare Blog
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
U
Unit 42
Vercel News
Vercel News
L
LangChain Blog
博客园 - 司徒正美
H
Help Net Security
Recent Announcements
Recent Announcements
Recorded Future
Recorded Future
V
Visual Studio Blog
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
Y
Y Combinator Blog
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
B
Blog RSS Feed
F
Fortinet All Blogs
B
Blog
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
罗磊的独立博客
博客园_首页
MyScale Blog
MyScale Blog
aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
量子位
I
InfoQ
小众软件
小众软件
P
Proofpoint News Feed

PBS activity

Make capypdf a submodule (7f9465b6) · Commits · Inkscape / inkscape · GitLab Draft: Make capypdf a submodule to enable it in the PPA (!7987) · Merge requests · Inkscape / inkscape · GitLab a7a272aeb209d29b500adb09d575af1d89645ffe to f9f9d913e36b14250122d9bc43911b5bb84e958c · PBS / Inkscape · GitLab Make capypdf a submodule (12ee5f11) · Commits · Inkscape / inkscape · GitLab Commits · launchpad-staging · Inkscape / inkscape · GitLab Commits · unmeson · PBS / Inkscape · GitLab Objects can't be moved using arrows keys (#6226) · Issues · Inkscape / inkscape · GitLab Down, left, right arrow keys don't work to move objects (#13628) · Issues · Inkscape / Inbox · GitLab Down, left, right arrow keys don't work to move objects (#13628) · Issues · Inkscape / Inbox · GitLab Draft: Expand tests for boolean operations on paths (!7980) · Merge requests · Inkscape / inkscape · GitLab 1.5-dev: cannot create/open documents after closing window on macOS (#5981) · Issues · Inkscape / inkscape · GitLab Use new Modifiers system for the arc tool (!7961) · Merge requests · Inkscape / inkscape · GitLab Remove dependency on deprecated appdirs module (!730) · Merge requests · Inkscape / extensions · GitLab Commits · appdirs · PBS / extensions · GitLab 1.5-dev: Unable to open the Extension Manager (#6202) · Issues · Inkscape / inkscape · GitLab PBS pushed to project branch capypdf-static at PBS / Inkscape PBS pushed to project branch capypdf-static at PBS / Inkscape Make internal capypdf static (!7947) · Merge requests · Inkscape / inkscape · GitLab Shape builder tool does not detect the interior region (#4477) · Issues · Inkscape / inkscape · GitLab Make (most) tests build and run on Windows (!7940) · Merge requests · Inkscape / inkscape · GitLab Generate AppImage with quick-sharun (a465f4ce) · Commits · PBS / Inkscape · GitLab Commits · sharun · PBS / Inkscape · GitLab 1.5-dev: Split mode state is incorrect in the menu when opening a new document (#6135) · Issues · Inkscape / inkscape · GitLab PBS deleted project branch deadlock-win at PBS / Inkscape 1.5-dev: (Windows) Deadlock on quit, process not exiting sometimes (#6003) · Issues · Inkscape / inkscape · GitLab Fix dark mode on gtk 4.20 (!7932) · Merge requests · Inkscape / inkscape · GitLab Fix some resizing issues on Windows by not setting GTK_CSD (!7931) · Merge requests · Inkscape / inkscape · GitLab Draft: Fix AppImage crashing during save on older distros (!7922) · Merge requests · Inkscape / inkscape · GitLab 19086deebf770c8932b403ee536c8f8562a376f9 to 55362ef7d4c363d9613d70ac7194de7e8e323a34 · PBS / Inkscape · GitLab c74f78ca23ff302b7b59175490b870f1a616b778 to 19086deebf770c8932b403ee536c8f8562a376f9 · PBS / Inkscape · GitLab acf9cb2511a84e64f6009a1f23078da8ff51485a to c74f78ca23ff302b7b59175490b870f1a616b778 · PBS / Inkscape · GitLab Fix objects dialog search crash with missing object ID (!7918) · 合并请求 · Inkscape / inkscape · GitLab "Manage Extensions" throws error with AppImage (#5787) · Issues · Inkscape / inkscape · GitLab ca8baeeb44cbf234ffefa9da10974fb713d1e51a to 1a4da430266ea3d674bc5dc49106bacb6528e099 · PBS / Inkscape · GitLab 84543dab97c1f116e9636f149a031f2256199c87 to c7d8378ccc109bdb2ed30f0c8407725e93ffdd9b · Inkscape / lib2geom · GitLab Update split mode on tab switch (!7915) · Merge requests · Inkscape / inkscape · GitLab inset/offset as app functions so they can be used from CLI (!7914) · Merge requests · Inkscape / inkscape · GitLab Update split mode on tab switch (21bbbaa7) · Commits · PBS / Inkscape · GitLab Commits · split-mode-tab · PBS / Inkscape · GitLab Update split mode on tab switch (7fdf74dd) · Commits · Inkscape / inkscape · GitLab [Regression] Right-aligned text has a new gap in 1.4.4 (#6130) · Issues · Inkscape / inkscape · GitLab 55362ef7d4c363d9613d70ac7194de7e8e323a34 to a2b678d5ad5ae2ee02aa4d7d0ec7a856048190c0 · PBS / Inkscape · GitLab Speed up ungroup on thousands of items (!7908) · Merge requests · Inkscape / inkscape · GitLab AppImage build does not support OpenGL mode (#3428) · Issues · Inkscape / inkscape · GitLab Pressure sensitivity broken in AppImage (#5962) · Issues · Inkscape / inkscape · GitLab 3bd629c13b87c4ab2af3d126f86ddcc8bbf2f149 to ca8baeeb44cbf234ffefa9da10974fb713d1e51a · PBS / Inkscape · GitLab Fix breakage with Ubuntu 26.04 CI (!7904) · 合并请求 · Inkscape / inkscape · GitLab 242c9b14b996730e92eae6015fead1cf3cc2d8e9 to 3bd629c13b87c4ab2af3d126f86ddcc8bbf2f149 · PBS / Inkscape · GitLab Fix breakage with Ubuntu 26.04 CI (c7d8378c) · 提交 · PBS / lib2geom · GitLab Update more reference images (242c9b14) · 提交 · PBS / Inkscape · GitLab 1daba12d820308823d302201e3cf2eafbaac1ac6 to 0aa687aa9bafa055619749a9867e536b80ece385 · PBS / Inkscape · GitLab 647ee7f47a87a5c87285487d3c6029acf635ed01 to 469601f7445709b71dd3b8670333d7e1b49d86fb · PBS / lib2geom · GitLab Use supersampling to reduce fuzz, update reference images (1daba12d) · 提交 · PBS / Inkscape · GitLab Update peppercarrot reference image (cc92988a) · 提交 · PBS / Inkscape · GitLab Fix CJK / Hebrew problems (1ea593ef) · 提交 · PBS / Inkscape · GitLab Add argument file to bypass Windows command length limits (!7899) · 合并请求 · Inkscape / inkscape · GitLab Fix some tests (20705d53) · Commits · PBS / Inkscape · GitLab Update Color API preparing for new Rendering Engine (!7894) · Merge requests · Inkscape / inkscape · GitLab New UX for text in shape and text in path (!7827) · Merge requests · Inkscape / inkscape · GitLab Fix tests in debian packaging (!7838) · Merge requests · Inkscape / inkscape · GitLab Draft: Upgrade to Ubuntu 26.04 (!64) · Merge requests · Inkscape / inkscape-ci-docker · GitLab Draft: Fix breakage with Ubuntu 26.04 CI (!148) · Merge requests · Inkscape / lib2geom · GitLab [DRAFT] Temporarily disable lpe tests (a2995490) · Commits · PBS / Inkscape · GitLab aa6bd703d4a5ed9d81838ec3ed16da623bc742b1 to 2ab70cbfd1a9e6707a14099ea0c0c11ae3134e7f · PBS / Inkscape · GitLab db745239d11d97540b6cae0872ac61ef59008e24 to 647ee7f47a87a5c87285487d3c6029acf635ed01 · PBS / lib2geom · GitLab ed16d3e6e8f776b32b54919d982459479f832325 to aa6bd703d4a5ed9d81838ec3ed16da623bc742b1 · PBS / Inkscape · GitLab Fix breakage with Ubuntu 26.04 CI (db745239) · Commits · PBS / lib2geom · GitLab Fix breakage with Ubuntu 26.04 CI (6e40e833) · Commits · PBS / lib2geom · GitLab Commits · resolute · PBS / lib2geom · GitLab Commits · resolute · PBS / Inkscape · GitLab Commits · resolute · PBS / inkscape-ci-docker · GitLab Upgrade to Ubuntu 26.04 (c283b8d1) · Commits · Inkscape / inkscape-ci-docker · GitLab Implement support for all color font formats. 1.5.x (!7565) · Merge requests · Inkscape / inkscape · GitLab Refactor paint server data so the renderer works from data (!7859) · Merge requests · Inkscape / inkscape · GitLab Fix page repainting when document y-axis is flipped (!7861) · Merge requests · Inkscape / inkscape · GitLab PBS deleted project branch various-fixes at PBS / lib2geom Duplicated expression in if statement inside path-intersection.cpp (#27) · Issues · Inkscape / lib2geom · GitLab 2geom.pc.in hardcodes "lib" for libdir (#81) · Issues · Inkscape / lib2geom · GitLab IntPoint / double = IntPoint (should be Point) (#76) · Issues · Inkscape / lib2geom · GitLab EllipticalArc::pointAndDerivatives() returns too many derivatives (#83) · Issues · Inkscape / lib2geom · GitLab b1273d10b17f7c0fa23016c12477577ce667b8cf to 84543dab97c1f116e9636f149a031f2256199c87 · Inkscape / lib2geom · GitLab ad6bc46c3a1186b640711410a05406e07c1b9eae to 290d47f6d9d60d5be0d5a76856339b0ff5695c4d · PBS / Inkscape · GitLab Fix dispatch_pool hang on exit on Windows (!7794) · Merge requests · Inkscape / inkscape · GitLab 4d22039de3d9c2ae1a6337852e55bed06b20193b to f529b2aace8ad98fdcadcb50da810163215512bb · Inkscape / inkscape · GitLab Do not run any build-time tests when building the deb package (!7792) · Merge requests · Inkscape / inkscape · GitLab Make internal capypdf static (bf1e16d7) · Commits · PBS / Inkscape · GitLab Commits · capypdf-static · PBS / Inkscape · GitLab Make internal capypdf static (61bdd93d) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (17be81e7) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (7e09228f) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (0a5473eb) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (e32360c2) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (202e9499) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (64b041bb) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (1a9d977c) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (7a095661) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (b9ac0d79) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (dc2381e3) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (fcb272c3) · Commits · PBS / Inkscape · GitLab Make internal capypdf static (c9323296) · Commits · Inkscape / inkscape · GitLab
Add custom color palette support to bitmap tracing with novel color quantization algorithm (!7862) · Merge requests · Inkscape / inkscape · GitLab
2026-04-14 · via PBS activity

Add custom color palette support to bitmap tracing with novel color quantization algorithm

  • Review changes

  • Download

NOTE: This PR has been co-authored by Claude.ai. I could not find the official policy of Inkscape regarding AI contributions. Please discard this PR if it contravenes Inkscape policies. The code has been checked and tested by myself (in addition to running ninja check).


Allow users to define their own color palette (or modify the auto-generated one) for multi-color tracing (Trace Bitmap > Multicolor > Colors), instead of relying solely on automatic octree color quantization.

This addresses a pain point when vectorizing a bitmap and getting a lot of similar colors, missing important hues present in the image.

When "Colors" mode is selected in the Multicolor tab, a palette editor replaces the scans slider. The palette is automatically populated by analyzing the selected image (sampling 10K pixels out of the image, so that it remains always reponsive). The optimal number of colors and their values are determined without user interaction.

Each color is shown as a row with:

  • A color swatch: hover to see the eyedropper icon, click to pick a color directly from the canvas (reuses the dropper tool's one-time pick mechanism, same as Fill & Stroke)
  • A hex label with disclosure arrow: click to expand an inline color picker with HSL/RGB sliders (reuses ColorPickerPanel, the same widget as Fill & Stroke)
  • A delete button to remove individual colors

The "+" button uses constrained k-means to find the best next color to add (the most distinctive color not yet covered by the palette). The refresh button re-extracts the optimal palette from the image.

The custom palette is then passed through to the tracing engine, which maps each pixel to the nearest palette color instead of running octree quantization. The rest of the tracing pipeline (per-color mask creation, potrace vectorization, stacking) works unchanged.

The attached SVG shows the old vs new color quantization algorithm on a range of different bitmap types: samples_tracing_autopalette.svg

Perceptual color quantization

The previous octree quantization operated in raw RGB space and allocated colors proportionally to pixel count: a large gray background would consume most of the palette while small vivid regions (e.g. colored flowers) were lost.

The new approach uses saliency-weighted k-means in Oklab perceptual color space:

  1. Oklab color space: Euclidean distance in Oklab closely matches perceived color difference, so the algorithm naturally preserves hue diversity rather than clustering around brightness variations.
  2. Local chroma saliency weighting: Before running k-means, each pixel is weighted by how much its chroma differs from its local neighborhood. Pixels at color boundaries and in small distinctive regions get ~20× more influence than uniform background pixels. This steers k-means toward visually important colors without sacrificing clustering quality.
  3. Automatic palette size: The elbow method on k-means inertia determines the optimal number of colors (2–10), biased slightly toward richer palettes.
  4. Pixel-to-palette assignment also uses Oklab distance, so each pixel maps to the color that looks closest, not just the geometrically nearest in RGB.

The old octree quantization is preserved for QUANT_MONO and BRIGHTNESS_MULTI modes where the output is converted to grayscale anyway.

Implementation notes

  • Oklab conversion is implemented directly in quantize.cpp rather than reusing ok_color::linear_srgb_to_oklab() from src/colors/spaces/ok-color.cpp, because those functions are internal to the color picker widget (not declared in the public header), use different types, and operate on linear sRGB without handling the transfer function. A self-contained implementation avoids coupling between unrelated subsystems.
  • Palette swatches use GtkSnapshot (snapshot_vfunc with gtk_snapshot_append_color) instead of Cairo, following the approach established in !7765 (merged).
  • The inline color picker uses a shared ColorPickerPanel instance (with PlateType::None) that is inserted below the active row and bound to its ColorSet, ensuring full UI consistency with Fill & Stroke.
Edited by Séverin Lemaignan