RunMat
GitHub

gray2rgb — Replicate a grayscale image into an RGB truecolor image.

gray2rgb(I) replicates an MxN grayscale image across red, green, and blue planes to produce MxNx3 truecolor data.

How gray2rgb works

  • Accepts MxN grayscale images.
  • Preserves host tensor dtype metadata.

Example

Replicate Gray To RGB

RGB = gray2rgb(I);

Expected output:

% RGB is MxNx3

Open-source implementation

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

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.

Getting started · Benchmarks · Pricing

Try RunMat for free

Open the sandbox and start running MATLAB code in seconds. No account required.