RunMat
GitHub

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

NameTypeRequiredDefaultDescription
LABAnyYesCIE L*a*b* image or Nx3 colormap values.

Returns

NameTypeDescription
RGBNumericArraysRGB image or colormap converted from CIE L*a*b* input.

Errors

IdentifierWhenMessage
RunMat:lab2rgb:TooManyInputsMore than one input argument is supplied.lab2rgb: too many input arguments
RunMat:lab2rgb:InvalidInputInput cannot be interpreted as an MxNx3 L*a*b* image or Nx3 colormap.lab2rgb: invalid input
RunMat:lab2rgb:InternalRGB 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 channels

Using 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.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how lab2rgb is executed, line by line, in Rust.

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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.