ind2rgb — Convert indexed image data and a colormap to RGB truecolor data.
ind2rgb(X, map) maps indexed image values through an Nx3 colormap and returns truecolor RGB data.
How ind2rgb works
- Double and single index arrays use 1-based colormap indices.
- uint8 and uint16 index arrays use zero-based indexed-image values.
- The output appends a third RGB channel dimension.
Example
Indexed Image To RGB
RGB = ind2rgb(X, map);Expected output:
% RGB is size(X) with a third RGB channelRelated Image functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how ind2rgb works, line by line, in Rust.
- View ind2rgb.rs on GitHub
- Learn how the runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.
- Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
- Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
- A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.