lab2rgb — Convert CIE L*a*b* values to sRGB using MATLAB-compatible D65 conversion defaults.
lab2rgb(LAB) converts L*a*b* image or colormap data to sRGB values under D65 assumptions. It follows MATLAB-compatible channel and output-shape behavior for supported numeric inputs.
Syntax
RGB = lab2rgb(LAB)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
LAB | Any | Yes | — | CIE L*a*b* image or Nx3 colormap values. |
Returns
| Name | Type | Description |
|---|---|---|
RGB | NumericArray | sRGB image or colormap converted from CIE L*a*b* input. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:lab2rgb:TooManyInputs | More than one input argument is supplied. | lab2rgb: too many input arguments |
RunMat:lab2rgb:InvalidInput | Input cannot be interpreted as an MxNx3 L*a*b* image or Nx3 colormap. | lab2rgb: invalid input |
RunMat:lab2rgb:Internal | RGB output tensor construction fails internally. | lab2rgb: internal conversion failure |
How lab2rgb works
- Accepts MxNx3 Lab images and Nx3 Lab colormaps.
- Out-of-gamut RGB values are clipped to [0,1].
- Name-value options are not implemented in this Tier 1 version.
Example
Lab To RGB
RGB = lab2rgb(LAB);Expected output:
% RGB has red, green, and blue channelsUsing lab2rgb with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how lab2rgb changes the result.
Run a small lab2rgb example, explain the result, then change one input and compare the output.
Related Image functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how lab2rgb is executed, line by line, in Rust.
- View the source for lab2rgb in Rust on GitHub
- Learn how the RunMat 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 blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.