Unify colormaps: render-time apply (pseudocolor) + pipeline-based decode#9
Merged
Conversation
Rework the colormap feature into one unified, non-destructive design with
two directions, both flowing through the central ImageRenderer pipeline so
they work for every format and for layers.
- Add shared media/modules/colormaps.js as the single source of truth:
getColormapLut() (cached 256-entry RGB LUT) and rgbToColormapIndex()
(cached 32^3 inverse cube for O(N) decode).
- Apply ("add color"): new displayColormap render setting, hooked once in
ImageRenderer.render() — single-channel grayscale output is remapped
through the colormap LUT (NaN pixels preserved). Reversible and
non-destructive; works in layers since the compositor uses the same path.
- Decode ("remove color"): rewrite the broken canvas-mutating converter.
The decoded scalar becomes a first-class single-channel float source that
re-renders through ImageRenderer (so normalization/gamma/apply-colormap all
work) and feeds the pixel inspector via a new decodedValueProvider.
- UX: context menu splits into "Apply Colormap…"/"Remove Colormap" for
single-channel images (fixes the missing option on float TIFFs) and
"Decode Colormap to Float" for RGB images; add tiffVisualizer.applyColormap
command; persist displayColormap across tab switches.
- Guard the PNG lazy-native fast path so a requested colormap forces the
central pipeline.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…o norm boundary info text
kleinicke
added a commit
that referenced
this pull request
Jun 17, 2026
Unify colormaps: render-time apply (pseudocolor) + pipeline-based decode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks colormaps into one unified, non-destructive feature with two directions, both flowing through the central ImageRenderer pipeline (so they work for every format and for layers).
Issues with the colormaps were reported in #2
media/modules/colormaps.js—getColormapLut()(cached 256-entry RGB LUT) andrgbToColormapIndex()(cached 32³ inverse cube → O(N) decode).displayColormaprender setting, hooked once inImageRenderer.render(): single-channel grayscale is remapped through the LUT (NaN preserved). Reversible, non-destructive, works in layers.tiffVisualizer.applyColormapcommand;displayColormappersists across tab switches.formatInfo(full menu/status bars restored); gamma-mode normalization labels are type-aware (0-1float,0-255/0-65535integer).Testing